use of io.leopard.web.mvc.condition.ServerNameRequestCondition in project leopard by tanhaichao.
the class LeopardHandlerMapping method createRequestMappingInfo2.
/**
* Created a RequestMappingInfo from a RequestMapping annotation.
*/
protected RequestMappingInfo createRequestMappingInfo2(RequestMapping annotation, Method method) {
String[] patterns;
if (method != null && annotation.value().length == 0) {
patterns = new String[] { this.createPattern(method.getName()) };
} else {
patterns = resolveEmbeddedValuesInPatterns(annotation.value());
}
Map<String, String> headerMap = new LinkedHashMap<String, String>();
ExtensiveDomain extensiveDomain = new ExtensiveDomain();
requestMappingInfoBuilder.getHeaders(annotation, method, extensiveDomain, headerMap);
// System.out.println("headerMap:" + headerMap);
String[] headers = new String[headerMap.size()];
{
int i = 0;
for (Entry<String, String> entry : headerMap.entrySet()) {
String header = entry.getKey() + "=" + entry.getValue();
headers[i] = header;
i++;
}
}
RequestCondition<?> customCondition = new ServerNameRequestCondition(extensiveDomain, headers);
return new RequestMappingInfo(new PatternsRequestCondition(patterns, getUrlPathHelper(), getPathMatcher(), false, this.useTrailingSlashMatch(), this.getFileExtensions()), new RequestMethodsRequestCondition(annotation.method()), new ParamsRequestCondition(annotation.params()), new HeadersRequestCondition(), new ConsumesRequestCondition(annotation.consumes(), headers), new ProducesRequestCondition(annotation.produces(), headers, getContentNegotiationManager()), customCondition);
}
Aggregations