WebInitParam[] params = annotation.initParams();
for (int i = 0; i < params.length; i++) {
filterDef.addInitParameter(params[i].name(), params[i].value());
}
context.addFilterDef(filterDef);
FilterMap filterMap = new FilterMap();
filterMap.setFilterName(filterName);
String[] urlPatterns = annotation.urlPatterns();
if (urlPatterns != null) {
for (int i = 0; i < urlPatterns.length; i++) {
filterMap.addURLPattern(urlPatterns[i]);
}
}
String[] servletNames = annotation.servletNames();
if (servletNames != null) {
for (int i = 0; i < servletNames.length; i++) {
filterMap.addServletName(servletNames[i]);
}
}
DispatcherType[] dispatcherTypes = annotation.dispatcherTypes();
if (dispatcherTypes != null) {
for (int i = 0; i < dispatcherTypes.length; i++) {
filterMap.setDispatcher(dispatcherTypes[i].toString());
}
}
context.addFilterMap(filterMap);
}
if (clazz.isAnnotationPresent(WebServlet.class)) {