use of cn.taketoday.web.handler.condition.PathPatternsRequestCondition in project today-infrastructure by TAKETODAY.
the class RequestMappingInfoHandlerMapping method handleMatch.
/**
* Expose URI template variables, matrix variables, and producible media types in the request.
*/
@Override
protected void handleMatch(Match bestMatch, String lookupPath, RequestContext request) {
super.handleMatch(bestMatch, lookupPath, request);
RequestMappingInfo info = bestMatch.mapping;
PathPatternsRequestCondition pathPatternsCondition = info.getPathPatternsCondition();
HandlerMatchingMetadata matchingMetadata = new HandlerMatchingMetadata(bestMatch.getHandlerMethod(), lookupPath, request.getLookupPath(), CollectionUtils.firstElement(pathPatternsCondition.getPatterns()), getPatternParser());
request.setMatchingMetadata(matchingMetadata);
Set<MediaType> mediaTypes = info.getProducesCondition().getProducibleMediaTypes();
if (!mediaTypes.isEmpty()) {
matchingMetadata.setProducibleMediaTypes(mediaTypes.toArray(new MediaType[0]));
}
}
use of cn.taketoday.web.handler.condition.PathPatternsRequestCondition in project today-framework by TAKETODAY.
the class RequestMappingInfoHandlerMapping method handleMatch.
/**
* Expose URI template variables, matrix variables, and producible media types in the request.
*/
@Override
protected void handleMatch(Match bestMatch, String lookupPath, RequestContext request) {
super.handleMatch(bestMatch, lookupPath, request);
RequestMappingInfo info = bestMatch.mapping;
PathPatternsRequestCondition pathPatternsCondition = info.getPathPatternsCondition();
HandlerMatchingMetadata matchingMetadata = new HandlerMatchingMetadata(bestMatch.getHandlerMethod(), lookupPath, request.getLookupPath(), CollectionUtils.firstElement(pathPatternsCondition.getPatterns()), getPatternParser());
request.setMatchingMetadata(matchingMetadata);
Set<MediaType> mediaTypes = info.getProducesCondition().getProducibleMediaTypes();
if (!mediaTypes.isEmpty()) {
matchingMetadata.setProducibleMediaTypes(mediaTypes.toArray(new MediaType[0]));
}
}
Aggregations