Commit 5f3d5fbe authored by Phillip Webb's avatar Phillip Webb

Remove public "skip path extension" constant

Remove the public constant to make it clearer that skipping path
extensions is really an internal Spring Boot concern.

See gh-8765
parent 69a8c0d8
...@@ -29,7 +29,6 @@ import javax.servlet.http.HttpServletRequest; ...@@ -29,7 +29,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -295,12 +294,13 @@ public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint> ...@@ -295,12 +294,13 @@ public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint>
private static final class SkipPathExtensionContentNegotiation private static final class SkipPathExtensionContentNegotiation
extends HandlerInterceptorAdapter { extends HandlerInterceptorAdapter {
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP";
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws Exception { Object handler) throws Exception {
request.setAttribute( request.setAttribute(SKIP_ATTRIBUTE, Boolean.TRUE);
WebMvcAutoConfiguration.SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE,
Boolean.TRUE);
return true; return true;
} }
......
...@@ -153,13 +153,6 @@ public class WebMvcAutoConfiguration { ...@@ -153,13 +153,6 @@ public class WebMvcAutoConfiguration {
public static final String DEFAULT_SUFFIX = ""; public static final String DEFAULT_SUFFIX = "";
/**
* Attribute that can be added to the web request when the
* {@link PathExtensionContentNegotiationStrategy} should be be skipped.
*/
public static final String SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP";
@Bean @Bean
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class) @ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() { public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() {
...@@ -610,6 +603,9 @@ public class WebMvcAutoConfiguration { ...@@ -610,6 +603,9 @@ public class WebMvcAutoConfiguration {
static class OptionalPathExtensionContentNegotiationStrategy static class OptionalPathExtensionContentNegotiationStrategy
implements ContentNegotiationStrategy { implements ContentNegotiationStrategy {
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP";
private final ContentNegotiationStrategy delegate; private final ContentNegotiationStrategy delegate;
OptionalPathExtensionContentNegotiationStrategy( OptionalPathExtensionContentNegotiationStrategy(
...@@ -620,8 +616,7 @@ public class WebMvcAutoConfiguration { ...@@ -620,8 +616,7 @@ public class WebMvcAutoConfiguration {
@Override @Override
public List<MediaType> resolveMediaTypes(NativeWebRequest webRequest) public List<MediaType> resolveMediaTypes(NativeWebRequest webRequest)
throws HttpMediaTypeNotAcceptableException { throws HttpMediaTypeNotAcceptableException {
Object skip = webRequest.getAttribute( Object skip = webRequest.getAttribute(SKIP_ATTRIBUTE,
SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE,
RequestAttributes.SCOPE_REQUEST); RequestAttributes.SCOPE_REQUEST);
if (skip != null && Boolean.parseBoolean(skip.toString())) { if (skip != null && Boolean.parseBoolean(skip.toString())) {
return Collections.emptyList(); return Collections.emptyList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment