Java Code Examples for org.apache.catalina.Context#addServletSecurity()
The following examples show how to use
org.apache.catalina.Context#addServletSecurity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StandardWrapper.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
private void processServletSecurityAnnotation(Class<?> clazz) { // Calling this twice isn't harmful so no syncs servletSecurityAnnotationScanRequired = false; Context ctxt = (Context) getParent(); if (ctxt.getIgnoreAnnotations()) { return; } ServletSecurity secAnnotation = clazz.getAnnotation(ServletSecurity.class); if (secAnnotation != null) { ctxt.addServletSecurity( new ApplicationServletRegistration(this, ctxt), new ServletSecurityElement(secAnnotation)); } }
Example 2
Source File: WebAnnotationSet.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * Process the annotations for the servlets. * * @param context The context which will have its annotations processed */ protected static void loadApplicationServletAnnotations(Context context) { Container[] children = context.findChildren(); for (Container child : children) { if (child instanceof Wrapper) { Wrapper wrapper = (Wrapper) child; if (wrapper.getServletClass() == null) { continue; } Class<?> clazz = Introspection.loadClass(context, wrapper.getServletClass()); if (clazz == null) { continue; } loadClassAnnotation(context, clazz); loadFieldsAnnotation(context, clazz); loadMethodsAnnotation(context, clazz); /* Process RunAs annotation which can be only on servlets. * Ref JSR 250, equivalent to the run-as element in * the deployment descriptor */ RunAs runAs = clazz.getAnnotation(RunAs.class); if (runAs != null) { wrapper.setRunAs(runAs.value()); } // Process ServletSecurity annotation ServletSecurity servletSecurity = clazz.getAnnotation(ServletSecurity.class); if (servletSecurity != null) { context.addServletSecurity( new ApplicationServletRegistration(wrapper, context), new ServletSecurityElement(servletSecurity)); } } } }