return ConfigReader.getInstance().getConfig().getViewPath();
}
@SuppressWarnings("unchecked")
private void addObjectToContext(BeanDefinition beanDef, List<String> uriList) {
WebBeanDefinition beanDefinition = (WebBeanDefinition) beanDef;
// 注册Controller里面声明的uri
List<Method> list = beanDefinition.getReqMethods();
if (list != null) {
for (Method m : list) {
m.setAccessible(true);
final String uri = m.getAnnotation(RequestMapping.class)
.value();
final String method = m.getAnnotation(RequestMapping.class)
.method();
String view = m.getAnnotation(RequestMapping.class).view();
view = VerifyUtils.isNotEmpty(view) ? view : ConfigReader
.getInstance().getConfig().getViewType();
String key = method + "@" + uri;
// 构造请求uri对应的方法的元信息
MvcMetaInfo mvcMetaInfo = new MvcMetaInfo(
beanDefinition.getObject(), m, getViewHandle(view));
map.put(key, mvcMetaInfo);
uriList.add(key);
if (key.charAt(key.length() - 1) == '/') {
key = key.substring(0, key.length() - 1);
log.info("register uri [{}], view [{}]", key, view);
} else {
log.info("register uri [{}], view [{}]", key, view);
key += "/";
}
map.put(key, mvcMetaInfo);
uriList.add(key);
}
}
list = beanDefinition.getInterceptorMethods();
if (list != null) {
log.debug("interceptorMethods size [{}]", list.size());
for (Method m : list) {
m.setAccessible(true);
List<String> l = getInterceptUri(
beanDefinition.getUriPattern(), uriList);
log.debug("interceptorUri size [{}]", l.size());
for (String i : l) {
String key = m.getName().charAt(0) + "#" + i;
// 构造拦截器的元信息
MvcMetaInfo mvcMetaInfo = new MvcMetaInfo(
beanDefinition.getObject(), m,
getViewHandle(beanDefinition.getView()));
mvcMetaInfo.setInterceptOrder(beanDefinition.getOrder());
Set<MvcMetaInfo> interceptorSet = (Set<MvcMetaInfo>) map
.get(key);
if (interceptorSet == null) {
interceptorSet = new TreeSet<MvcMetaInfo>();
interceptorSet.add(mvcMetaInfo);