org.apache.catalina.core.ApplicationServletRegistration Java Examples

The following examples show how to use org.apache.catalina.core.ApplicationServletRegistration. 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: WebAnnotationSet.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 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));
            }
        }
    }
}
 
Example #2
Source File: FailedContext.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public Set<String> addServletSecurity(
        ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement) { return null; }
 
Example #3
Source File: TesterContext.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public Set<String> addServletSecurity(
        ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement) {
    return null;
}
 
Example #4
Source File: FailedContext.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public Set<String> addServletSecurity(
        ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement) { return null; }
 
Example #5
Source File: TesterContext.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public Set<String> addServletSecurity(
        ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement) {
    return null;
}
 
Example #6
Source File: Context.java    From Tomcat7.0.67 with Apache License 2.0 2 votes vote down vote up
/**
 * Notification that servlet security has been dynamically set in a
 * {@link javax.servlet.ServletRegistration.Dynamic}
 * @param registration servlet security was modified for
 * @param servletSecurityElement new security constraints for this servlet
 * @return urls currently mapped to this registration that are already
 *         present in web.xml
 */
Set<String> addServletSecurity(ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement);
 
Example #7
Source File: Context.java    From tomcatsrc with Apache License 2.0 2 votes vote down vote up
/**
 * Notification that servlet security has been dynamically set in a
 * {@link javax.servlet.ServletRegistration.Dynamic}
 * @param registration servlet security was modified for
 * @param servletSecurityElement new security constraints for this servlet
 * @return urls currently mapped to this registration that are already
 *         present in web.xml
 */
Set<String> addServletSecurity(ApplicationServletRegistration registration,
        ServletSecurityElement servletSecurityElement);