String servletClassName = servlet.getServletClass().getStringValue();
Class<?> cls = bundle.loadClass(servletClassName);
if (!Servlet.class.isAssignableFrom(cls)) {
continue;
}
ServletSecurity servletSecurity = cls.getAnnotation(ServletSecurity.class);
if (servletSecurity == null) {
continue;
}
Set<String> urlPatterns = servletClassNameUrlPatternsMap.get(servletClassName);
if (urlPatterns == null || urlPatterns.isEmpty()) {
if (logger.isDebugEnabled()) {
logger.debug("No url pattern for the servlet class " + servletClassName + " is found in the deployment plan, SecurityConstraint annotation is ignored");
}
continue;
}
HttpConstraint httpConstraint = servletSecurity.value();
if (servletSecurity.httpMethodConstraints().length > 0) {
String[] omissionMethods = new String[servletSecurity.httpMethodConstraints().length];
int iIndex = 0;
for (HttpMethodConstraint httpMethodConstraint : servletSecurity.httpMethodConstraints()) {
//Generate a security-constraint for each HttpMethodConstraint
String httpMethod = httpMethodConstraint.value().trim();
omissionMethods[iIndex++] = httpMethod;
addNewHTTPMethodSecurityConstraint(annotationSecurityWebApp, httpMethodConstraint.rolesAllowed(), httpMethodConstraint.transportGuarantee(), httpMethodConstraint
.emptyRoleSemantic(), httpMethod, urlPatterns);