Skip to content

Commit 5f3d5fb

Browse files
committed
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
1 parent 69a8c0d commit 5f3d5fb

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/AbstractEndpointHandlerMapping.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import javax.servlet.http.HttpServletResponse;
3030

3131
import org.springframework.boot.actuate.endpoint.Endpoint;
32-
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
3332
import org.springframework.context.ApplicationContext;
3433
import org.springframework.util.Assert;
3534
import org.springframework.util.ObjectUtils;
@@ -295,12 +294,13 @@ protected CorsConfiguration initCorsConfiguration(Object handler, Method method,
295294
private static final class SkipPathExtensionContentNegotiation
296295
extends HandlerInterceptorAdapter {
297296

297+
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
298+
.getName() + ".SKIP";
299+
298300
@Override
299301
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
300302
Object handler) throws Exception {
301-
request.setAttribute(
302-
WebMvcAutoConfiguration.SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE,
303-
Boolean.TRUE);
303+
request.setAttribute(SKIP_ATTRIBUTE, Boolean.TRUE);
304304
return true;
305305
}
306306

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,6 @@ public class WebMvcAutoConfiguration {
153153

154154
public static final String DEFAULT_SUFFIX = "";
155155

156-
/**
157-
* Attribute that can be added to the web request when the
158-
* {@link PathExtensionContentNegotiationStrategy} should be be skipped.
159-
*/
160-
public static final String SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
161-
.getName() + ".SKIP";
162-
163156
@Bean
164157
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
165158
public OrderedHiddenHttpMethodFilter hiddenHttpMethodFilter() {
@@ -610,6 +603,9 @@ private List<MediaType> getAcceptedMediaTypes(HttpServletRequest request) {
610603
static class OptionalPathExtensionContentNegotiationStrategy
611604
implements ContentNegotiationStrategy {
612605

606+
private static final String SKIP_ATTRIBUTE = PathExtensionContentNegotiationStrategy.class
607+
.getName() + ".SKIP";
608+
613609
private final ContentNegotiationStrategy delegate;
614610

615611
OptionalPathExtensionContentNegotiationStrategy(
@@ -620,8 +616,7 @@ static class OptionalPathExtensionContentNegotiationStrategy
620616
@Override
621617
public List<MediaType> resolveMediaTypes(NativeWebRequest webRequest)
622618
throws HttpMediaTypeNotAcceptableException {
623-
Object skip = webRequest.getAttribute(
624-
SKIP_PATH_EXTENSION_CONTENT_NEGOTIATION_ATTRIBUTE,
619+
Object skip = webRequest.getAttribute(SKIP_ATTRIBUTE,
625620
RequestAttributes.SCOPE_REQUEST);
626621
if (skip != null && Boolean.parseBoolean(skip.toString())) {
627622
return Collections.emptyList();

0 commit comments

Comments
 (0)