Skip to content

Commit fad7633

Browse files
committed
Polishing
1 parent 730bd02 commit fad7633

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

spring-web/src/main/java/org/springframework/web/util/WebUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public abstract class WebUtils {
109109
/**
110110
* Use of response encoding for HTML escaping parameter at the servlet context level
111111
* (i.e. a context-param in {@code web.xml}): "responseEncodedHtmlEscape".
112+
* @since 4.1.2
112113
*/
113114
public static final String RESPONSE_ENCODED_HTML_ESCAPE_CONTEXT_PARAM = "responseEncodedHtmlEscape";
114115

@@ -221,6 +222,7 @@ public static Boolean getDefaultHtmlEscape(ServletContext servletContext) {
221222
* default in case of no setting at the global level.
222223
* @param servletContext the servlet context of the web application
223224
* @return whether response encoding is used for HTML escaping (null = no explicit default)
225+
* @since 4.1.2
224226
*/
225227
public static Boolean getResponseEncodedHtmlEscape(ServletContext servletContext) {
226228
if (servletContext == null) {

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.net.URLDecoder;
2222
import java.util.ArrayList;
2323
import java.util.List;
24-
2524
import javax.activation.FileTypeMap;
2625
import javax.activation.MimetypesFileTypeMap;
2726
import javax.servlet.ServletException;
@@ -30,6 +29,7 @@
3029

3130
import org.apache.commons.logging.Log;
3231
import org.apache.commons.logging.LogFactory;
32+
3333
import org.springframework.beans.factory.InitializingBean;
3434
import org.springframework.core.io.ClassPathResource;
3535
import org.springframework.core.io.Resource;
@@ -51,29 +51,30 @@
5151
* (according to the guidelines of Page Speed, YSlow, etc.) by allowing for flexible cache settings
5252
* ({@linkplain #setCacheSeconds "cacheSeconds" property}, last-modified support).
5353
*
54-
* <p>The {@linkplain #setLocations "locations" property} takes a list of Spring {@link Resource} locations
55-
* from which static resources are allowed to be served by this handler. For a given request, the
56-
* list of locations will be consulted in order for the presence of the requested resource, and the
54+
* <p>The {@linkplain #setLocations "locations" property} takes a list of Spring {@link Resource}
55+
* locations from which static resources are allowed to be served by this handler. For a given request,
56+
* the list of locations will be consulted in order for the presence of the requested resource, and the
5757
* first found match will be written to the response, with {@code Expires} and {@code Cache-Control}
5858
* headers set as configured. The handler also properly evaluates the {@code Last-Modified} header
5959
* (if present) so that a {@code 304} status code will be returned as appropriate, avoiding unnecessary
6060
* overhead for resources that are already cached by the client. The use of {@code Resource} locations
61-
* allows resource requests to easily be mapped to locations other than the web application root. For
62-
* example, resources could be served from a classpath location such as "classpath:/META-INF/public-web-resources/",
63-
* allowing convenient packaging and serving of resources such as a JavaScript library from within jar files.
61+
* allows resource requests to easily be mapped to locations other than the web application root.
62+
* For example, resources could be served from a classpath location such as
63+
* "classpath:/META-INF/public-web-resources/", allowing convenient packaging and serving of resources
64+
* such as a JavaScript library from within jar files.
6465
*
6566
* <p>To ensure that users with a primed browser cache get the latest changes to application-specific
66-
* resources upon deployment of new versions of the application, it is recommended that a version string
67-
* is used in the URL mapping pattern that selects this handler. Such patterns can be easily parameterized
68-
* using Spring EL. See the reference manual for further examples of this approach.
67+
* resources upon deployment of new versions of the application, it is recommended that a version
68+
* string is used in the URL mapping pattern that selects this handler. Such patterns can be easily
69+
* parameterized using Spring EL. See the reference manual for further examples of this approach.
6970
*
70-
* <p>For various front-end needs &mdash; such as ensuring that users with a primed browser cache get the
71-
* latest changes, or serving variations of resources (e.g., minified versions) &mdash;
71+
* <p>For various front-end needs &mdash; such as ensuring that users with a primed browser cache
72+
* get the latest changes, or serving variations of resources (e.g., minified versions) &mdash;
7273
* {@link org.springframework.web.servlet.resource.ResourceResolver}s can be configured.
7374
*
7475
* <p>This handler can be configured through use of a
75-
* {@link org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry} or the {@code <mvc:resources/>}
76-
* XML configuration element.
76+
* {@link org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry}
77+
* or the {@code <mvc:resources/>} XML configuration element.
7778
*
7879
* @author Keith Donald
7980
* @author Jeremy Grelle
@@ -118,9 +119,8 @@ public List<Resource> getLocations() {
118119

119120
/**
120121
* Configure the list of {@link ResourceResolver}s to use.
121-
*
122-
* <p>By default {@link PathResourceResolver} is configured. If using this property, it
123-
* is recommended to add {@link PathResourceResolver} as the last resolver.
122+
* <p>By default {@link PathResourceResolver} is configured. If using this property,
123+
* it is recommended to add {@link PathResourceResolver} as the last resolver.
124124
*/
125125
public void setResourceResolvers(List<ResourceResolver> resourceResolvers) {
126126
this.resourceResolvers.clear();
@@ -272,7 +272,8 @@ protected Resource getResource(HttpServletRequest request) throws IOException {
272272
if (resource == null || getResourceTransformers().isEmpty()) {
273273
return resource;
274274
}
275-
ResourceTransformerChain transformChain = new DefaultResourceTransformerChain(resolveChain, getResourceTransformers());
275+
ResourceTransformerChain transformChain =
276+
new DefaultResourceTransformerChain(resolveChain, getResourceTransformers());
276277
resource = transformChain.transform(request, resource);
277278
return resource;
278279
}

0 commit comments

Comments
 (0)