Browse Source

Use HttpMethod enums

See gh-26855
pull/26893/head
Bryce Yang 5 years ago committed by Rossen Stoyanchev
parent
commit
55faf6e320
  1. 5
      spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

5
spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

@ -49,6 +49,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator; @@ -49,6 +49,7 @@ import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.core.log.LogFormatUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.server.RequestPath;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.lang.Nullable;
@ -1046,8 +1047,8 @@ public class DispatcherServlet extends FrameworkServlet { @@ -1046,8 +1047,8 @@ public class DispatcherServlet extends FrameworkServlet {
// Process last-modified header, if supported by the handler.
String method = request.getMethod();
boolean isGet = "GET".equals(method);
if (isGet || "HEAD".equals(method)) {
boolean isGet = HttpMethod.GET.matches(method);
if (isGet || HttpMethod.HEAD.matches(method)) {
long lastModified = ha.getLastModified(request, mappedHandler.getHandler());
if (new ServletWebRequest(request, response).checkNotModified(lastModified) && isGet) {
return;

Loading…
Cancel
Save