Package org.apache.catalina

Examples of org.apache.catalina.Wrapper


    public static ServletInfo getApplicationServlet(Context context, String servletName) {
        Container c = context.findChild(servletName);

        if (c instanceof Wrapper) {
            Wrapper w = (Wrapper) c;
            return getServletInfo(w, context.getName());
        } else {
            return null;
        }
    }
View Full Code Here


    public static List getApplicationServlets(Context context) {
        Container[] cns = context.findChildren();
        List servlets = new ArrayList(cns.length);
        for (int i = 0; i < cns.length; i++) {
            if (cns[i] instanceof Wrapper) {
                Wrapper w = (Wrapper) cns[i];
                servlets.add(getServletInfo(w, context.getName()));
            }
        }
        return servlets;
    }
View Full Code Here

                    sm.setApplicationName(context.getName().length() > 0 ? context.getName() : "/");
                    sm.setUrl(sms[i]);
                    sm.setServletName(sn);
                    Container c = context.findChild(sn);
                    if (c instanceof Wrapper) {
                        Wrapper w = (Wrapper) c;
                        sm.setServletClass(w.getServletClass());
                        sm.setAvailable(! w.isUnavailable());
                    }
                    servletMaps.add(sm);
                }
            }
        }
View Full Code Here

               // fall through...
            case Status.STATUS_PREPARED:
               String servletName = "<Unknown>";
               try
               {
                  Wrapper servlet = request.getWrapper();
                  if (servlet != null)
                  {
                     servletName = servlet.getName();
                     if (servlet.getJspFile() != null)
                        servletName = servlet.getJspFile();
                  }
               }
               catch (Throwable ignored)
               {
               }

               String msg = "Application error: " + servletName + " did not complete its transaction";
               log.error(msg);
         }
      }
      finally
      {
         try
         {
            Transaction tx = tm.suspend();
            if (tx != null)
            {
               String servletName = "<Unknown>";
               try
               {
                  Wrapper servlet = request.getWrapper();
                  if (servlet != null)
                  {
                     servletName = servlet.getName();
                     if (servlet.getJspFile() != null)
                        servletName = servlet.getJspFile();
                  }
               }
               catch (Throwable ignored)
               {
               }
View Full Code Here

         for (AnnotationMetaData annotation : annotations)
         {
            String className = annotation.getClassName();
            Container wrappers[] = context.findChildren();
            for (int i = 0; i < wrappers.length; i++) {
                Wrapper wrapper = (Wrapper) wrappers[i];
                if (className.equals(wrapper.getServletClass()))
                {
                  
                   // Merge @RunAs
                   if (annotation.getRunAs() != null && wrapper.getRunAs() == null)
                   {
                      wrapper.setRunAs(annotation.getRunAs().getRoleName());
                   }
                   // Merge @MultipartConfig
                   if (annotation.getMultipartConfig() != null && wrapper.getMultipartConfig() == null)
                   {
                      MultipartConfigMetaData multipartConfigMetaData = annotation.getMultipartConfig();
                      Multipart multipartConfig = new Multipart();
                      multipartConfig.setLocation(multipartConfigMetaData.getLocation());
                      multipartConfig.setMaxRequestSize(multipartConfigMetaData.getMaxRequestSize());
                      multipartConfig.setMaxFileSize(multipartConfigMetaData.getMaxFileSize());
                      multipartConfig.setFileSizeThreshold(multipartConfigMetaData.getFileSizeThreshold());
                      wrapper.setMultipartConfig(multipartConfig);
                   }
                   // Merge @ServletSecurity
                   if (annotation.getServletSecurity() != null && wrapper.getServletSecurity() == null)
                   {
                      ServletSecurityMetaData servletSecurityAnnotation = annotation.getServletSecurity();
                      Collection<HttpMethodConstraintElement> methodConstraints = null;
                     
                      EmptyRoleSemantic emptyRoleSemantic =  EmptyRoleSemantic.PERMIT;
                      if (servletSecurityAnnotation.getEmptyRoleSemantic() != null)
                      {
                         emptyRoleSemantic = EmptyRoleSemantic.valueOf(servletSecurityAnnotation.getEmptyRoleSemantic().toString());
                      }
                      TransportGuarantee transportGuarantee = TransportGuarantee.NONE;
                      if (servletSecurityAnnotation.getTransportGuarantee() != null)
                      {
                         transportGuarantee = TransportGuarantee.valueOf(servletSecurityAnnotation.getTransportGuarantee().toString());
                      }
                      String[] roleNames = servletSecurityAnnotation.getRolesAllowed().toArray(new String[0]);
                      HttpConstraintElement constraint = new HttpConstraintElement(emptyRoleSemantic, transportGuarantee, roleNames);
                     
                      if (servletSecurityAnnotation.getHttpMethodConstraints() != null)
                      {
                         methodConstraints = new HashSet<HttpMethodConstraintElement>();
                         for (HttpMethodConstraintMetaData annotationMethodConstraint :
                            servletSecurityAnnotation.getHttpMethodConstraints())
                         {
                            emptyRoleSemantic =  EmptyRoleSemantic.PERMIT;
                            if (annotationMethodConstraint.getEmptyRoleSemantic() != null)
                            {
                               emptyRoleSemantic = EmptyRoleSemantic.valueOf(annotationMethodConstraint.getEmptyRoleSemantic().toString());
                            }
                            transportGuarantee = TransportGuarantee.NONE;
                            if (annotationMethodConstraint.getTransportGuarantee() != null)
                            {
                               transportGuarantee = TransportGuarantee.valueOf(annotationMethodConstraint.getTransportGuarantee().toString());
                            }
                            roleNames = annotationMethodConstraint.getRolesAllowed().toArray(new String[0]);
                            HttpConstraintElement constraint2 =
                               new HttpConstraintElement(emptyRoleSemantic, transportGuarantee, roleNames);
                            HttpMethodConstraintElement methodConstraint =
                               new HttpMethodConstraintElement(annotationMethodConstraint.getMethod(), constraint2);
                            methodConstraints.add(methodConstraint);
                         }
                      }
                     
                      ServletSecurityElement servletSecurity = new ServletSecurityElement(constraint, methodConstraints);
                      wrapper.setServletSecurity(servletSecurity);
                   }
                  
                }
            }
         }
View Full Code Here

      String servletName = null;
      //WebProgrammaticAuthentication does not go through hasResourcePermission
      //and hence the activeRequest thread local may not be set
      Request req = ActiveRequestResponseCacheValve.activeRequest.get();
      Wrapper servlet = req.getWrapper();
      if (servlet != null)
      {
         servletName = getServletName(servlet);
      }
View Full Code Here

      if( trace )
         log.trace("Begin invoke, caller="+caller);
     
      try
      {
         Wrapper servlet = null;
         try
         {
            servlet = request.getWrapper();
            if (servlet != null)
            {
               String name = servlet.getName();
               RunAsIdentityMetaData identity = metaData.getRunAsIdentity(name);
               RunAsIdentity runAsIdentity = null;
               if(identity != null)
               {
                  if (trace)
View Full Code Here

      if( trace )
         log.trace("Begin invoke, caller="+caller);
     
      try
      {
         Wrapper servlet = null;
         try
         {
            servlet = request.getWrapper();
            if (servlet != null)
            {
               String name = servlet.getName();
               RunAsIdentityMetaData identity = metaData.getRunAsIdentity(name);
               RunAsIdentity runAsIdentity = null;
               if(identity != null)
               {
                  if (trace)
View Full Code Here

        Host host = embedded.createHost("127.0.0.1", path);
        engine.addChild(host);

        Context c = embedded.createContext("/", path);
        c.setReloadable(false);
        Wrapper w = c.createWrapper();
        w.addMapping("/*");
        w.setServletClass(TomcatAtmosphereServlet.class.getName());
        w.setLoadOnStartup(0);

        c.addChild(w);
        host.addChild(c);

        Connector connector = embedded.createConnector("127.0.0.1",port,Http11NioProtocol.class.getName());
        connector.setContainer(host);
        embedded.addEngine(engine);
        embedded.addConnector(connector);
        embedded.start();

        atmoServlet = (AtmosphereServlet) w.getServlet();

    }
View Full Code Here

        Host host = embedded.createHost("127.0.0.1", path);
        engine.addChild(host);

        Context c = embedded.createContext("/", path);
        c.setReloadable(false);
        Wrapper w = c.createWrapper();
        w.addMapping("/*");
        w.setServletClass(TomcatAtmosphereServlet.class.getName());
        w.setLoadOnStartup(0);
        //w.addInitParameter(CometSupport.MAX_INACTIVE, "20000");

        c.addChild(w);
        host.addChild(c);       

        Connector connector = embedded.createConnector("127.0.0.1",port,Http11NioProtocol.class.getName());
        connector.setContainer(host);
        embedded.addEngine(engine);
        embedded.addConnector(connector);
        embedded.start();
        atmoServlet = (AtmosphereServlet) w.getServlet();

    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.Wrapper

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.