Polish
This commit is contained in:
@@ -20,7 +20,6 @@ import java.util.Enumeration;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|||||||
@@ -59,9 +59,6 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv
|
|||||||
*/
|
*/
|
||||||
public class RequestResponseBodyMethodProcessor extends AbstractMessageConverterMethodProcessor {
|
public class RequestResponseBodyMethodProcessor extends AbstractMessageConverterMethodProcessor {
|
||||||
|
|
||||||
private static final List<HttpMethod> SUPPORTED_METHODS =
|
|
||||||
Arrays.asList(HttpMethod.POST, HttpMethod.PUT, HttpMethod.PATCH);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor with converters only. Suitable for resolving
|
* Basic constructor with converters only. Suitable for resolving
|
||||||
* {@code @RequestBody}. For handling {@code @ResponseBody} consider also
|
* {@code @RequestBody}. For handling {@code @ResponseBody} consider also
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ public class AppCacheManifestTransformer extends ResourceTransformerSupport {
|
|||||||
|
|
||||||
private class CacheSection implements SectionTransformer {
|
private class CacheSection implements SectionTransformer {
|
||||||
|
|
||||||
private final String COMMENT_DIRECTIVE = "#";
|
private static final String COMMENT_DIRECTIVE = "#";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String transform(String line, HashBuilder builder, Resource resource,
|
public String transform(String line, HashBuilder builder, Resource resource,
|
||||||
|
|||||||
@@ -199,6 +199,8 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the HTTP 1.0 expires header is used.
|
* Return whether the HTTP 1.0 expires header is used.
|
||||||
|
*
|
||||||
|
* @deprecated in favor of {@link #getCacheControl}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final boolean isUseExpiresHeader() {
|
public final boolean isUseExpiresHeader() {
|
||||||
@@ -220,6 +222,8 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the HTTP 1.1 cache-control header is used.
|
* Return whether the HTTP 1.1 cache-control header is used.
|
||||||
|
*
|
||||||
|
* @deprecated in favor of {@link #getCacheControl}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final boolean isUseCacheControlHeader() {
|
public final boolean isUseCacheControlHeader() {
|
||||||
@@ -240,6 +244,8 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether the HTTP 1.1 cache-control header value "no-store" is used.
|
* Return whether the HTTP 1.1 cache-control header value "no-store" is used.
|
||||||
|
*
|
||||||
|
* @deprecated in favor of {@link #getCacheControl}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final boolean isUseCacheControlNoStore() {
|
public final boolean isUseCacheControlNoStore() {
|
||||||
@@ -262,6 +268,8 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether 'must-revalidate' is added to every Cache-Control header.
|
* Return whether 'must-revalidate' is added to every Cache-Control header.
|
||||||
|
*
|
||||||
|
* @deprecated in favor of {@link #getCacheControl}.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isAlwaysMustRevalidate() {
|
public boolean isAlwaysMustRevalidate() {
|
||||||
@@ -315,6 +323,17 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||||||
checkAndPrepare(request, response, this.cacheControl);
|
checkAndPrepare(request, response, this.cacheControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * Check and prepare the given request and response according to the settings
|
||||||
|
* of this generator. Checks for supported methods and a required session,
|
||||||
|
* and applies the number of cache seconds specified for this generator.
|
||||||
|
* @param request current HTTP request
|
||||||
|
* @param response current HTTP response
|
||||||
|
* @param lastModified whether the underlying handler writes "Last-Modified" headers; in that case,
|
||||||
|
* a "Cache-Control: must-revalidate" directive is set in the response.
|
||||||
|
* @throws ServletException if the request cannot be handled because a check failed
|
||||||
|
* @deprecated in favor of {@link #checkAndPrepare(HttpServletRequest, HttpServletResponse, CacheControl)}.
|
||||||
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected final void checkAndPrepare(
|
protected final void checkAndPrepare(
|
||||||
HttpServletRequest request, HttpServletResponse response, boolean lastModified)
|
HttpServletRequest request, HttpServletResponse response, boolean lastModified)
|
||||||
@@ -362,10 +381,8 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether a session is required.
|
// Check whether a session is required.
|
||||||
if (this.requireSession) {
|
if (this.requireSession && request.getSession(false) == null) {
|
||||||
if (request.getSession(false) == null) {
|
throw new HttpSessionRequiredException("Pre-existing session required but none found");
|
||||||
throw new HttpSessionRequiredException("Pre-existing session required but none found");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package org.springframework.web.servlet.mvc;
|
|||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
|
|||||||
Reference in New Issue
Block a user