mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
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
This commit is contained in:
parent
69a8c0d871
commit
5f3d5fbec1
@ -29,7 +29,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.Endpoint;
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@ -295,12 +294,13 @@ public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint>
|
||||
private static final class SkipPathExtensionContentNegotiation
|
||||
extends HandlerInterceptorAdapter {
|
||||
|
||||
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
|
||||
.getName() + ".SKIP";
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler) throws Exception {
|
||||
request.setAttribute(
|
||||
WebMvcAutoConfiguration.SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE,
|
||||
Boolean.TRUE);
|
||||
request.setAttribute(SKIP_ATTRIBUTE, Boolean.TRUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -153,13 +153,6 @@ public class WebMvcAutoConfiguration {
|
||||
|
||||
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
|
||||
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
|
||||
public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() {
|
||||
@ -610,6 +603,9 @@ public class WebMvcAutoConfiguration {
|
||||
static class OptionalPathExtensionContentNegotiationStrategy
|
||||
implements ContentNegotiationStrategy {
|
||||
|
||||
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
|
||||
.getName() + ".SKIP";
|
||||
|
||||
private final ContentNegotiationStrategy delegate;
|
||||
|
||||
OptionalPathExtensionContentNegotiationStrategy(
|
||||
@ -620,8 +616,7 @@ public class WebMvcAutoConfiguration {
|
||||
@Override
|
||||
public List<MediaType> resolveMediaTypes(NativeWebRequest webRequest)
|
||||
throws HttpMediaTypeNotAcceptableException {
|
||||
Object skip = webRequest.getAttribute(
|
||||
SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE,
|
||||
Object skip = webRequest.getAttribute(SKIP_ATTRIBUTE,
|
||||
RequestAttributes.SCOPE_REQUEST);
|
||||
if (skip != null && Boolean.parseBoolean(skip.toString())) {
|
||||
return Collections.emptyList();
|
||||
|
Loading…
Reference in New Issue
Block a user