Polish interceptor registration MVC config

This commit is contained in:
Rossen Stoyanchev
2014-07-17 23:47:56 -04:00
parent 84c11a5cc7
commit 27153b2982
2 changed files with 43 additions and 48 deletions

View File

@@ -85,21 +85,20 @@ public class InterceptorRegistration {
if (this.includePatterns.isEmpty() && this.excludePatterns.isEmpty()) {
return this.interceptor;
}
MappedInterceptor mappedInterceptor = new MappedInterceptor(
toArray(this.includePatterns), toArray(this.excludePatterns), interceptor);
String[] include = toArray(this.includePatterns);
String[] exclude = toArray(this.excludePatterns);
MappedInterceptor mappedInterceptor = new MappedInterceptor(include, exclude, this.interceptor);
if (this.pathMatcher != null) {
mappedInterceptor.setPathMatcher(this.pathMatcher);
}
return mappedInterceptor;
}
private static String[] toArray(List<String> list) {
if (CollectionUtils.isEmpty(list)) {
return null;
}
else {
return list.toArray(new String[list.size()]);
}
return (CollectionUtils.isEmpty(list) ? null : list.toArray(new String[list.size()]));
}
}