Skip to content

Commit c9b26d8

Browse files
committed
Polish resource chain documentation
1 parent c61552b commit c9b26d8

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistration.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
2929

3030
/**
31-
* Encapsulates information required to create a resource handlers.
31+
* Encapsulates information required to create a resource handler.
3232
*
3333
* @author Rossen Stoyanchev
3434
* @author Keith Donald
3535
* @author Brian Clozel
36-
*
3736
* @since 3.1
3837
*/
3938
public class ResourceHandlerRegistration {
@@ -70,7 +69,7 @@ public ResourceHandlerRegistration(ResourceLoader resourceLoader, String... path
7069
* <p>For example, {{@code "/"}, {@code "classpath:/META-INF/public-web-resources/"}} allows resources to
7170
* be served both from the web application root and from any JAR on the classpath that contains a
7271
* {@code /META-INF/public-web-resources/} directory, with resources in the web application root taking precedence.
73-
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
72+
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
7473
*/
7574
public ResourceHandlerRegistration addResourceLocations(String... resourceLocations) {
7675
for (String location : resourceLocations) {
@@ -84,7 +83,7 @@ public ResourceHandlerRegistration addResourceLocations(String... resourceLocati
8483
* send any cache headers but to rely on last-modified timestamps only. Set to 0 in order to send cache headers
8584
* that prevent caching, or to a positive number of seconds to send cache headers with the given max-age value.
8685
* @param cachePeriod the time to cache resources in seconds
87-
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
86+
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
8887
*/
8988
public ResourceHandlerRegistration setCachePeriod(Integer cachePeriod) {
9089
this.cachePeriod = cachePeriod;
@@ -93,13 +92,12 @@ public ResourceHandlerRegistration setCachePeriod(Integer cachePeriod) {
9392

9493
/**
9594
* Specify the {@link org.springframework.http.CacheControl} which should be used
96-
* by the the resource handler.
95+
* by the resource handler.
9796
*
9897
* <p>Setting a custom value here will override the configuration set with {@link #setCachePeriod}.
9998
*
10099
* @param cacheControl the CacheControl configuration to use
101-
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
102-
*
100+
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
103101
* @since 4.2
104102
*/
105103
public ResourceHandlerRegistration setCacheControl(CacheControl cacheControl) {
@@ -109,16 +107,16 @@ public ResourceHandlerRegistration setCacheControl(CacheControl cacheControl) {
109107

110108
/**
111109
* Configure a chain of resource resolvers and transformers to use. This
112-
* can be useful for example to apply a version strategy to resource URLs.
110+
* can be useful, for example, to apply a version strategy to resource URLs.
113111
*
114112
* <p>If this method is not invoked, by default only a simple
115113
* {@link PathResourceResolver} is used in order to match URL paths to
116114
* resources under the configured locations.
117115
*
118116
* @param cacheResources whether to cache the result of resource resolution;
119-
* setting this to "true" is recommended for production (and "false" for
120-
* development, especially when applying a version strategy).
121-
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
117+
* setting this to "true" is recommended for production (and "false" for
118+
* development, especially when applying a version strategy)
119+
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
122120
* @since 4.1
123121
*/
124122
public ResourceChainRegistration resourceChain(boolean cacheResources) {
@@ -128,20 +126,21 @@ public ResourceChainRegistration resourceChain(boolean cacheResources) {
128126

129127
/**
130128
* Configure a chain of resource resolvers and transformers to use. This
131-
* can be useful for example to apply a version strategy to resource URLs.
129+
* can be useful, for example, to apply a version strategy to resource URLs.
132130
*
133131
* <p>If this method is not invoked, by default only a simple
134132
* {@link PathResourceResolver} is used in order to match URL paths to
135133
* resources under the configured locations.
136134
*
137135
* @param cacheResources whether to cache the result of resource resolution;
138-
* setting this to "true" is recommended for production (and "false" for
139-
* development, especially when applying a version strategy.
136+
* setting this to "true" is recommended for production (and "false" for
137+
* development, especially when applying a version strategy
140138
* @param cache the cache to use for storing resolved and transformed resources;
141-
* by default a {@link org.springframework.cache.concurrent.ConcurrentMapCache}
142-
* is used. As Resources aren't serializable and can be dependent of the application host,
143-
* one should not use a distributed cache but rather an in-memory cache.
144-
* @return the same {@link ResourceHandlerRegistration} instance for chained method invocation
139+
* by default a {@link org.springframework.cache.concurrent.ConcurrentMapCache}
140+
* is used. Since Resources aren't serializable and can be dependent on the
141+
* application host, one should not use a distributed cache but rather an
142+
* in-memory cache.
143+
* @return the same {@link ResourceHandlerRegistration} instance, for chained method invocation
145144
* @since 4.1
146145
*/
147146
public ResourceChainRegistration resourceChain(boolean cacheResources, Cache cache) {

spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.2.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@
491491
<xsd:annotation>
492492
<xsd:documentation><![CDATA[
493493
The name of the Cache Manager to cache resource resolution. By default, a ConcurrentCacheMap will be used.
494-
As Resources aren't serializable and can be dependent of the application host, one should not use a
494+
Since Resources aren't serializable and can be dependent on the application host, one should not use a
495495
distributed cache but rather an in-memory cache.
496496
]]></xsd:documentation>
497497
</xsd:annotation>

0 commit comments

Comments
 (0)