public class AppCacheManifestTransformer extends ResourceTransformerSupport
ResourceTransformer
implementation that helps handling resources
within HTML5 AppCache manifests for HTML5 offline applications.
This transformer:
ResourceResolver
strategies
All files that have the ".appcache" file extension, or the extension given in the constructor, will be transformed by this class. This hash is computed using the content of the appcache manifest and the content of the linked resources; so changing a resource linked in the manifest or the manifest itself should invalidate the browser cache.
In order to serve manifest files with the proper "text/manifest"
content type,
it is required to configure it with
requestedContentTypeResolverBuilder.mediaType("appcache", MediaType.valueOf("text/manifest")
in WebReactiveConfiguration.configureRequestedContentTypeResolver()
.
Constructor and Description |
---|
AppCacheManifestTransformer()
Create an AppCacheResourceTransformer that transforms files with extension ".appcache".
|
AppCacheManifestTransformer(String fileExtension)
Create an AppCacheResourceTransformer that transforms files with the extension
given as a parameter.
|
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<org.springframework.core.io.Resource> |
transform(org.springframework.web.server.ServerWebExchange exchange,
org.springframework.core.io.Resource inputResource,
ResourceTransformerChain chain)
Transform the given resource.
|
getResourceUrlProvider, resolveUrlPath, setResourceUrlProvider
public AppCacheManifestTransformer()
public AppCacheManifestTransformer(String fileExtension)
public reactor.core.publisher.Mono<org.springframework.core.io.Resource> transform(org.springframework.web.server.ServerWebExchange exchange, org.springframework.core.io.Resource inputResource, ResourceTransformerChain chain)
ResourceTransformer
exchange
- the current exchangeinputResource
- the resource to transformchain
- the chain of remaining transformers to delegate tonull
)