Adapt to Spring MVC API updates

See gh-45487
This commit is contained in:
Stéphane Nicoll
2025-05-08 21:57:42 -07:00
committed by Phillip Webb
parent c15418b693
commit 05fb37d046
8 changed files with 3 additions and 165 deletions

View File

@@ -249,11 +249,6 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
return null;
}
@Override
protected void extendInterceptors(List<Object> interceptors) {
interceptors.add(new SkipPathExtensionContentNegotiation());
}
/**
* Return the Handler providing actuator links at the root endpoint.
* @return the links handler

View File

@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -163,9 +162,4 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
return this.corsConfiguration;
}
@Override
protected void extendInterceptors(List<Object> interceptors) {
interceptors.add(new SkipPathExtensionContentNegotiation());
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.actuate.endpoint.web.servlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.HandlerInterceptor;
/**
* {@link HandlerInterceptor} to ensure that
* {@link org.springframework.web.accept.PathExtensionContentNegotiationStrategy} is
* skipped for web endpoints.
*
* @author Phillip Webb
*/
final class SkipPathExtensionContentNegotiation implements HandlerInterceptor {
@SuppressWarnings("deprecation")
private static final String SKIP_ATTRIBUTE = org.springframework.web.accept.PathExtensionContentNegotiationStrategy.class
.getName() + ".SKIP";
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
request.setAttribute(SKIP_ATTRIBUTE, Boolean.TRUE);
return true;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,6 +70,7 @@ public class RequestMappingConditionsDescription {
.toList();
}
@SuppressWarnings("removal")
private Set<String> extractPathPatterns(RequestMappingInfo requestMapping) {
PatternsRequestCondition patternsCondition = requestMapping.getPatternsCondition();
return (patternsCondition != null) ? patternsCondition.getPatterns()