Browse Source

DefaultServerRequest parses the path if necessary

Closes gh-25353
pull/25395/head
Rossen Stoyanchev 6 years ago
parent
commit
1dec4f3d0f
  1. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java

6
spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultServerRequest.java

@ -101,7 +101,11 @@ class DefaultServerRequest implements ServerRequest { @@ -101,7 +101,11 @@ class DefaultServerRequest implements ServerRequest {
this.params = CollectionUtils.toMultiValueMap(new ServletParametersMap(servletRequest));
this.attributes = new ServletAttributesMap(servletRequest);
this.requestPath = ServletRequestPathUtils.getParsedRequestPath(servletRequest);
// DispatcherServlet parses the path but for other scenarios (e.g. tests) we might need to
this.requestPath = (ServletRequestPathUtils.hasParsedRequestPath(servletRequest) ?
ServletRequestPathUtils.getParsedRequestPath(servletRequest) :
ServletRequestPathUtils.parseAndCache(servletRequest));
}
private static List<MediaType> allSupportedMediaTypes(List<HttpMessageConverter<?>> messageConverters) {

Loading…
Cancel
Save