Class<?> annType = ann.annotationType();
if (annType.equals(WebServlet.class)) {
WebServlet webServlet = (WebServlet) ann;
ServletMapping mapping = new ServletMapping();
for (String value : webServlet.value()) {
mapping.addURLPattern(value);
}
for (String value : webServlet.urlPatterns()) {
mapping.addURLPattern(value);
}
mapping.setBean(bean);
mapping.init();
_webApp.addServletMapping(mapping);
event.veto();
}
else if (annType.isAnnotationPresent(ServiceType.class)) {
ServiceType serviceType
= (ServiceType) annType.getAnnotation(ServiceType.class);
Class<?> factoryClass = serviceType.defaultFactory();
ProtocolServletFactory factory
= (ProtocolServletFactory) factoryClass.newInstance();
factory.setServiceType(ann);
factory.setAnnotated(annotated);
Method urlPatternMethod = annType.getMethod("urlPattern");
String urlPattern = (String) urlPatternMethod.invoke(ann);
ServletMapping mapping = new ServletMapping();
mapping.addURLPattern(urlPattern);
mapping.setBean(bean);
mapping.setProtocolFactory(factory);
mapping.init();
_webApp.addServletMapping(mapping);
// event.veto();
}