public class ResourceHandlerRegistration extends Object
| Constructor and Description | 
|---|
ResourceHandlerRegistration(String... pathPatterns)
Create a  
ResourceHandlerRegistration instance. | 
| Modifier and Type | Method and Description | 
|---|---|
ResourceHandlerRegistration | 
addResourceLocations(String... resourceLocations)
Add one or more resource locations from which to serve static content. 
 | 
protected String[] | 
getPathPatterns()
Return the URL path patterns for the resource handler. 
 | 
protected ResourceHttpRequestHandler | 
getRequestHandler()
Return a  
ResourceHttpRequestHandler instance. | 
ResourceChainRegistration | 
resourceChain(boolean cacheResources)
Configure a chain of resource resolvers and transformers to use. 
 | 
ResourceChainRegistration | 
resourceChain(boolean cacheResources,
             Cache cache)
Configure a chain of resource resolvers and transformers to use. 
 | 
ResourceHandlerRegistration | 
setCacheControl(CacheControl cacheControl)
Specify the  
CacheControl which should be used
 by the resource handler. | 
ResourceHandlerRegistration | 
setCachePeriod(Integer cachePeriod)
Specify the cache period for the resources served by the resource handler, in seconds. 
 | 
public ResourceHandlerRegistration(String... pathPatterns)
ResourceHandlerRegistration instance.pathPatterns - one or more resource URL path patternspublic ResourceHandlerRegistration addResourceLocations(String... resourceLocations)
For example, {"/", "classpath:/META-INF/public-web-resources/"}
 allows resources to be served both from the web application root and
 from any JAR on the classpath that contains a
 /META-INF/public-web-resources/ directory, with resources in the
 web application root taking precedence.
 
For URL-based resources
 (e.g. files, HTTP URLs, etc) this method supports a special prefix to
 indicate the charset associated with the URL so that relative paths
 appended to it can be encoded correctly, e.g.
 [charset=Windows-31J]https://example.org/path.
ResourceHandlerRegistration instance, for
 chained method invocationpublic ResourceHandlerRegistration setCachePeriod(Integer cachePeriod)
cachePeriod - the time to cache resources in secondsResourceHandlerRegistration instance, for chained method invocationpublic ResourceHandlerRegistration setCacheControl(CacheControl cacheControl)
CacheControl which should be used
 by the resource handler.
 Setting a custom value here will override the configuration set with setCachePeriod(java.lang.Integer).
cacheControl - the CacheControl configuration to useResourceHandlerRegistration instance, for chained method invocationpublic ResourceChainRegistration resourceChain(boolean cacheResources)
If this method is not invoked, by default only a simple
 PathResourceResolver is used in order to match URL paths to
 resources under the configured locations.
cacheResources - whether to cache the result of resource resolution;
 setting this to "true" is recommended for production (and "false" for
 development, especially when applying a version strategy)ResourceHandlerRegistration instance, for chained method invocationpublic ResourceChainRegistration resourceChain(boolean cacheResources, Cache cache)
If this method is not invoked, by default only a simple
 PathResourceResolver is used in order to match URL paths to
 resources under the configured locations.
cacheResources - whether to cache the result of resource resolution;
 setting this to "true" is recommended for production (and "false" for
 development, especially when applying a version strategycache - the cache to use for storing resolved and transformed resources;
 by default a ConcurrentMapCache
 is used. Since Resources aren't serializable and can be dependent on the
 application host, one should not use a distributed cache but rather an
 in-memory cache.ResourceHandlerRegistration instance, for chained method invocationprotected String[] getPathPatterns()
protected ResourceHttpRequestHandler getRequestHandler()
ResourceHttpRequestHandler instance.