protected String[] determineUrlsByAnnotations(Object handler) {
Class<? extends Object> handlerType = handler.getClass();
RequestMapping mapping = AnnotationUtils.findAnnotation(handlerType, RequestMapping.class);
if (mapping != null) {
// @RequestMapping found at type level
this.cachedMappings.put(handlerType, mapping);
Set<String> urls = new LinkedHashSet<String>();
String[] paths = mapping.value();
if (paths.length > 0) {
// @RequestMapping specifies paths at type level
for (String path : paths) {
addUrlsForPath(urls, path);
}
return StringUtils.toStringArray(urls);
} else {
// actual paths specified by @RequestMapping at method level
return determineUrlsForHandlerMethods(handlerType);
}
} else if (AnnotationUtils.findAnnotation(handlerType, Controller.class) != null) {
// @RequestMapping to be introspected at method level
return determineUrlsForHandlerMethods(handlerType);
} else {
return null;
}
}
ContextParentAnnotationHandlerMapping.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:spring-modular
作者:
评论列表
文章目录