Polish resource chain documentation
This commit is contained in:
@@ -28,12 +28,11 @@ import org.springframework.web.servlet.resource.PathResourceResolver;
|
||||
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
|
||||
|
||||
/**
|
||||
* Encapsulates information required to create a resource handlers.
|
||||
* Encapsulates information required to create a resource handler.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Keith Donald
|
||||
* @author Brian Clozel
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
public class ResourceHandlerRegistration {
|
||||
@@ -70,7 +69,7 @@ public class ResourceHandlerRegistration {
|
||||
* <p>For example, {{@code "/"}, {@code "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
|
||||
* {@code /META-INF/public-web-resources/} directory, with resources in the web application root taking precedence.
|
||||
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
|
||||
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
|
||||
*/
|
||||
public ResourceHandlerRegistration addResourceLocations(String... resourceLocations) {
|
||||
for (String location : resourceLocations) {
|
||||
@@ -84,7 +83,7 @@ public class ResourceHandlerRegistration {
|
||||
* send any cache headers but to rely on last-modified timestamps only. Set to 0 in order to send cache headers
|
||||
* that prevent caching, or to a positive number of seconds to send cache headers with the given max-age value.
|
||||
* @param cachePeriod the time to cache resources in seconds
|
||||
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
|
||||
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
|
||||
*/
|
||||
public ResourceHandlerRegistration setCachePeriod(Integer cachePeriod) {
|
||||
this.cachePeriod = cachePeriod;
|
||||
@@ -93,13 +92,12 @@ public class ResourceHandlerRegistration {
|
||||
|
||||
/**
|
||||
* Specify the {@link org.springframework.http.CacheControl} which should be used
|
||||
* by the the resource handler.
|
||||
* by the resource handler.
|
||||
*
|
||||
* <p>Setting a custom value here will override the configuration set with {@link #setCachePeriod}.
|
||||
*
|
||||
* @param cacheControl the CacheControl configuration to use
|
||||
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
|
||||
*
|
||||
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
|
||||
* @since 4.2
|
||||
*/
|
||||
public ResourceHandlerRegistration setCacheControl(CacheControl cacheControl) {
|
||||
@@ -109,16 +107,16 @@ public class ResourceHandlerRegistration {
|
||||
|
||||
/**
|
||||
* Configure a chain of resource resolvers and transformers to use. This
|
||||
* can be useful for example to apply a version strategy to resource URLs.
|
||||
* can be useful, for example, to apply a version strategy to resource URLs.
|
||||
*
|
||||
* <p>If this method is not invoked, by default only a simple
|
||||
* {@link PathResourceResolver} is used in order to match URL paths to
|
||||
* resources under the configured locations.
|
||||
*
|
||||
* @param 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).
|
||||
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
|
||||
* setting this to "true" is recommended for production (and "false" for
|
||||
* development, especially when applying a version strategy)
|
||||
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
|
||||
* @since 4.1
|
||||
*/
|
||||
public ResourceChainRegistration resourceChain(boolean cacheResources) {
|
||||
@@ -128,20 +126,21 @@ public class ResourceHandlerRegistration {
|
||||
|
||||
/**
|
||||
* Configure a chain of resource resolvers and transformers to use. This
|
||||
* can be useful for example to apply a version strategy to resource URLs.
|
||||
* can be useful, for example, to apply a version strategy to resource URLs.
|
||||
*
|
||||
* <p>If this method is not invoked, by default only a simple
|
||||
* {@link PathResourceResolver} is used in order to match URL paths to
|
||||
* resources under the configured locations.
|
||||
*
|
||||
* @param 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.
|
||||
* setting this to "true" is recommended for production (and "false" for
|
||||
* development, especially when applying a version strategy
|
||||
* @param cache the cache to use for storing resolved and transformed resources;
|
||||
* by default a {@link org.springframework.cache.concurrent.ConcurrentMapCache}
|
||||
* is used. As Resources aren't serializable and can be dependent of the application host,
|
||||
* one should not use a distributed cache but rather an in-memory cache.
|
||||
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
|
||||
* by default a {@link org.springframework.cache.concurrent.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.
|
||||
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
|
||||
* @since 4.1
|
||||
*/
|
||||
public ResourceChainRegistration resourceChain(boolean cacheResources, Cache cache) {
|
||||
|
||||
Reference in New Issue
Block a user