Browse Source

Merge branch '5.3.x'

pull/29167/head
Sébastien Deleuze 2 years ago
parent
commit
aa2d7dba5b
  1. 9
      spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMapping.java
  2. 9
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMapping.java

9
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMapping.java

@ -142,9 +142,12 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe @@ -142,9 +142,12 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
exchange.getAttributes().put(URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriVariables);
exchange.getAttributes().put(MATRIX_VARIABLES_ATTRIBUTE, matrixVariables);
if (!info.getProducesCondition().getProducibleMediaTypes().isEmpty()) {
Set<MediaType> mediaTypes = info.getProducesCondition().getProducibleMediaTypes();
exchange.getAttributes().put(PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, mediaTypes);
ProducesRequestCondition producesCondition = info.getProducesCondition();
if (!producesCondition.isEmpty()) {
Set<MediaType> mediaTypes = producesCondition.getProducibleMediaTypes();
if (!mediaTypes.isEmpty()) {
exchange.getAttributes().put(PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, mediaTypes);
}
}
}

9
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMapping.java

@ -148,9 +148,12 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe @@ -148,9 +148,12 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
extractMatchDetails((PatternsRequestCondition) condition, lookupPath, request);
}
if (!info.getProducesCondition().getProducibleMediaTypes().isEmpty()) {
Set<MediaType> mediaTypes = info.getProducesCondition().getProducibleMediaTypes();
request.setAttribute(PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, mediaTypes);
ProducesRequestCondition producesCondition = info.getProducesCondition();
if (!producesCondition.isEmpty()) {
Set<MediaType> mediaTypes = producesCondition.getProducibleMediaTypes();
if (!mediaTypes.isEmpty()) {
request.setAttribute(PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, mediaTypes);
}
}
}

Loading…
Cancel
Save