Merge branch '2.2.x'
This commit is contained in:
commit
6a1f61c1bf
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.web.servlet;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -52,15 +51,13 @@ class CompositeHandlerExceptionResolver implements HandlerExceptionResolver {
|
|||
if (this.resolvers == null) {
|
||||
this.resolvers = extractResolvers();
|
||||
}
|
||||
Optional<ModelAndView> modelAndView = this.resolvers.stream()
|
||||
ModelAndView resolved = this.resolvers.stream()
|
||||
.map((resolver) -> resolver.resolveException(request, response, handler, ex)).filter(Objects::nonNull)
|
||||
.findFirst();
|
||||
modelAndView.ifPresent((mav) -> {
|
||||
if (mav.isEmpty()) {
|
||||
request.setAttribute("javax.servlet.error.exception", ex);
|
||||
}
|
||||
});
|
||||
return modelAndView.orElse(null);
|
||||
.findFirst().orElse(null);
|
||||
if (resolved != null && resolved.isEmpty()) {
|
||||
request.setAttribute("javax.servlet.error.exception", ex);
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
||||
private List<HandlerExceptionResolver> extractResolvers() {
|
||||
|
|
|
@ -136,7 +136,7 @@ class WebMvcEndpointChildContextConfigurationIntegrationTests {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, ?> getResponseBody(ClientResponse response) {
|
||||
return (Map<String, ?>) response.bodyToMono(Map.class).block();
|
||||
return response.bodyToMono(Map.class).block();
|
||||
}
|
||||
|
||||
@Endpoint(id = "fail")
|
||||
|
|
|
@ -538,7 +538,12 @@ public class ServerProperties {
|
|||
this.redirectContextRoot = redirectContextRoot;
|
||||
}
|
||||
|
||||
public boolean getUseRelativeRedirects() {
|
||||
@Deprecated
|
||||
public Boolean getUseRelativeRedirects() {
|
||||
return this.useRelativeRedirects;
|
||||
}
|
||||
|
||||
public boolean isUseRelativeRedirects() {
|
||||
return this.useRelativeRedirects;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class TomcatServletWebServerFactoryCustomizer
|
|||
if (tomcatProperties.getRedirectContextRoot() != null) {
|
||||
customizeRedirectContextRoot(factory, tomcatProperties.getRedirectContextRoot());
|
||||
}
|
||||
customizeUseRelativeRedirects(factory, tomcatProperties.getUseRelativeRedirects());
|
||||
customizeUseRelativeRedirects(factory, tomcatProperties.isUseRelativeRedirects());
|
||||
factory.setDisableMBeanRegistry(!tomcatProperties.getMbeanregistry().isEnabled());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue