Package org.apache.catalina.core

Examples of org.apache.catalina.core.StandardWrapper


     * Process the annotations for the servlets.
     */
    protected static void loadApplicationServletAnnotations(Context context) {
       
        ClassLoader classLoader = context.getLoader().getClassLoader();
        StandardWrapper wrapper = null;
        Class classClass = null;
       
        Container[] children = context.findChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i] instanceof StandardWrapper) {
               
                wrapper = (StandardWrapper) children[i];
                if (wrapper.getServletClass() == null) {
                    continue;
                }
               
                try {
                    classClass = classLoader.loadClass(wrapper.getServletClass());
                } catch (ClassNotFoundException e) {
                    // We do nothing
                } catch (NoClassDefFoundError e) {
                    // We do nothing
                }
               
                if (classClass == null) {
                    continue;
                }
               
                loadClassAnnotation(context, wrapper.getServletClass());
                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                if (classClass.isAnnotationPresent(RunAs.class)) {
                    RunAs annotation = (RunAs)
                        classClass.getAnnotation(RunAs.class);
                    wrapper.setRunAs(annotation.value());
                }
            }
        }
       
       
View Full Code Here


     * Process the annotations for the servlets.
     */
    protected static void loadApplicationServletAnnotations(Context context) {
       
        ClassLoader classLoader = context.getLoader().getClassLoader();
        StandardWrapper wrapper = null;
        Class<?> classClass = null;
       
        Container[] children = context.findChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i] instanceof StandardWrapper) {
               
                wrapper = (StandardWrapper) children[i];
                if (wrapper.getServletClass() == null) {
                    continue;
                }
               
                try {
                    classClass = classLoader.loadClass(wrapper.getServletClass());
                } catch (ClassNotFoundException e) {
                    // We do nothing
                } catch (NoClassDefFoundError e) {
                    // We do nothing
                }
               
                if (classClass == null) {
                    continue;
                }
               
                loadClassAnnotation(context, wrapper.getServletClass());
                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                if (classClass.isAnnotationPresent(RunAs.class)) {
                    RunAs annotation = classClass.getAnnotation(RunAs.class);
                    wrapper.setRunAs(annotation.value());
                }
            }
        }
       
       
View Full Code Here

     * Process the annotations for the servlets.
     */
    protected static void loadApplicationServletAnnotations(Context context) {
       
        ClassLoader classLoader = context.getLoader().getClassLoader();
        StandardWrapper wrapper = null;
        Class classClass = null;
       
        Container[] children = context.findChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i] instanceof StandardWrapper) {
               
                wrapper = (StandardWrapper) children[i];
                if (wrapper.getServletClass() == null) {
                    continue;
                }
               
                try {
                    classClass = classLoader.loadClass(wrapper.getServletClass());
                } catch (ClassNotFoundException e) {
                    // We do nothing
                } catch (NoClassDefFoundError e) {
                    // We do nothing
                }
               
                if (classClass == null) {
                    continue;
                }
               
                loadClassAnnotation(context, wrapper.getServletClass());
                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                if (classClass.isAnnotationPresent(RunAs.class)) {
                    RunAs annotation = (RunAs)
                        classClass.getAnnotation(RunAs.class);
                    wrapper.setRunAs(annotation.value());
                }
            }
        }
       
       
View Full Code Here

     */
    public static StandardWrapper addServlet(StandardContext ctx,
                                      String servletName,
                                      String servletClass) {
        // will do class for name and set init params
        StandardWrapper sw = (StandardWrapper)ctx.createWrapper();
        sw.setServletClass(servletClass);
        sw.setName(servletName);
        ctx.addChild(sw);
       
        return sw;
    }
View Full Code Here

     */
    public static StandardWrapper addServlet(StandardContext ctx,
                                      String servletName,
                                      Servlet servlet) {
        // will do class for name and set init params
        StandardWrapper sw = new ExistingStandardWrapper(servlet);
        sw.setName(servletName);
        ctx.addChild(sw);
       
        return sw;
    }
View Full Code Here

     *  TODO: in normal tomcat, if default-web.xml is not found, use this
     *  method
     */
    public static void initWebappDefaults(StandardContext ctx) {
        // Default servlet
        StandardWrapper servlet = addServlet(
                ctx, "default", "org.apache.catalina.servlets.DefaultServlet");
        servlet.setLoadOnStartup(1);

        // JSP servlet (by class name - to avoid loading all deps)
        servlet = addServlet(
                ctx, "jsp", "org.apache.jasper.servlet.JspServlet");
        servlet.addInitParameter("fork", "false");
        servlet.setLoadOnStartup(3);
       
        // Servlet mappings
        ctx.addServletMapping("/", "default");
        ctx.addServletMapping("*.jsp", "jsp");
        ctx.addServletMapping("*.jspx", "jsp");
View Full Code Here

     * Process the annotations for the servlets.
     */
    protected static void loadApplicationServletAnnotations(Context context) {
       
        ClassLoader classLoader = context.getLoader().getClassLoader();
        StandardWrapper wrapper = null;
        Class<?> classClass = null;
       
        Container[] children = context.findChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i] instanceof StandardWrapper) {
               
                wrapper = (StandardWrapper) children[i];
                if (wrapper.getServletClass() == null) {
                    continue;
                }
               
                try {
                    classClass = classLoader.loadClass(wrapper.getServletClass());
                } catch (ClassNotFoundException e) {
                    // We do nothing
                } catch (NoClassDefFoundError e) {
                    // We do nothing
                }
               
                if (classClass == null) {
                    continue;
                }
               
                loadClassAnnotation(context, wrapper.getServletClass());

                // Multipart configuration annotation
                if (classClass.isAnnotationPresent(MultipartConfig.class)) {
                    MultipartConfig annotation =
                        (MultipartConfig) classClass.getAnnotation(MultipartConfig.class);
                    Multipart multipartConfig = new Multipart();
                    multipartConfig.setLocation(annotation.location());
                    multipartConfig.setMaxRequestSize(annotation.maxRequestSize());
                    multipartConfig.setMaxFileSize(annotation.maxFileSize());
                    multipartConfig.setFileSizeThreshold(annotation.fileSizeThreshold());
                    wrapper.setMultipartConfig(multipartConfig);
                }

                // Process JSR 250 access control annotations
                // Process PermitAll, TransportProtected and RolesAllowed on the class
                /*
 
View Full Code Here

     * Process the annotations for the servlets.
     */
    protected static void loadApplicationServletAnnotations(Context context) {
       
        ClassLoader classLoader = context.getLoader().getClassLoader();
        StandardWrapper wrapper = null;
        Class classClass = null;
       
        Container[] children = context.findChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i] instanceof StandardWrapper) {
               
                wrapper = (StandardWrapper) children[i];
                if (wrapper.getServletClass() == null) {
                    continue;
                }
               
                try {
                    classClass = classLoader.loadClass(wrapper.getServletClass());
                } catch (ClassNotFoundException e) {
                    // We do nothing
                } catch (NoClassDefFoundError e) {
                    // We do nothing
                }
               
                if (classClass == null) {
                    continue;
                }
               
                loadClassAnnotation(context, wrapper.getServletClass());
                /* Process RunAs annotation which can be only on servlets.
                 * Ref JSR 250, equivalent to the run-as element in
                 * the deployment descriptor
                 */
                if (classClass.isAnnotationPresent(RunAs.class)) {
                    RunAs annotation = (RunAs)
                        classClass.getAnnotation(RunAs.class);
                    wrapper.setRunAs(annotation.value());
                }
            }
        }
       
       
View Full Code Here

     */
    public StandardWrapper addServlet(StandardContext ctx,
                                      String servletName,
                                      String servletClass) {
        // will do class for name and set init params
        StandardWrapper sw = (StandardWrapper)ctx.createWrapper();
        sw.setServletClass(servletClass);
        sw.setName(servletName);
        ctx.addChild(sw);
       
        return sw;
    }
View Full Code Here

     */
    public StandardWrapper addServlet(StandardContext ctx,
                                      String servletName,
                                      Servlet servlet) {
        // will do class for name and set init params
        StandardWrapper sw = new ExistingStandardWrapper(servlet);
        sw.setName(servletName);
        ctx.addChild(sw);
       
        return sw;
    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.core.StandardWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.