Package org.apache.catalina.core

Examples of org.apache.catalina.core.StandardContext$DummyAnnotationProcessor


        if( log.isDebugEnabled() )
            log.debug("Creating context '" + path + "' with docBase '" +
                       docBase + "'");

        StandardContext context = new StandardContext();

        context.setDocBase(docBase);
        context.setPath(path);

        config.setCustomAuthenticators(authenticators);
        ((Lifecycle) context).addLifecycleListener(config);

        return (context);
View Full Code Here


         archive.as(ZipExporter.class).exportTo(archiveFile, true);

         embeddedHostConfig.deployWAR(archive.getName());

         final ContextName contextName = getContextName(archive);
         final StandardContext standardContext = (StandardContext) host.findChild(contextName.getName());
         standardContextProducer.set(standardContext);

         final HTTPContext httpContext = new HTTPContext(configuration.getBindAddress(),
               configuration.getBindHttpPort());

         for (String mapping : standardContext.findServletMappings())
         {
            httpContext.add(new Servlet(standardContext.findServletMapping(mapping), contextName.getPath()));
         }

         return new ProtocolMetaData().addContext(httpContext);
      }
      catch (Exception e)
View Full Code Here

            unregisterHost(host);
         }
      }
      else if (event.getData() instanceof StandardContext)
      {
         StandardContext context = (StandardContext)event.getData();

         //
         if (Container.ADD_CHILD_EVENT.equals(event.getType()))
         {
            registerContext(context);
View Full Code Here

         Container[] childrenContainers = host.findChildren();
         for (Container childContainer : childrenContainers)
         {
            if (childContainer instanceof StandardContext)
            {
               StandardContext context = (StandardContext)childContainer;
               registerContext(context);
            }
         }

         //
View Full Code Here

         Container[] childrenContainers = host.findChildren();
         for (Container childContainer : childrenContainers)
         {
            if (childContainer instanceof StandardContext)
            {
               StandardContext context = (StandardContext)childContainer;
               unregisterContext(context);
            }
         }
      }
   }
View Full Code Here

        }
        return count;
    }

    private StandardContext startWebApp(Host host) throws Exception {
        StandardContext context = new StandardContext();
        try {
            context.setPath(contextRoot);
            context.addLifecycleListener(new ContextConfig());
            File docBase = new File(serverTempDir, contextRoot);
            if (!docBase.exists()) {
                docBase.mkdirs();
            }
            context.setDocBase(docBase.getPath());

            final Loader loader = new WebCtxLoader(classloader);
            loader.setContainer(host);
            context.setLoader(loader);
            context.setInstanceManager(new LocalInstanceManager());

            final int j = servletClass.indexOf(".");
            final String servletName = j < 0 ? servletClass : servletClass.substring(j + 1);
            final Class<?> clazz = classloader.loadClass(servletClass);
            final Wrapper wsfsWrapper = context.createWrapper();
            wsfsWrapper.setName(servletName);
            wsfsWrapper.setServlet((Servlet) clazz.newInstance());
            wsfsWrapper.setServletClass(servletClass);
            context.addChild(wsfsWrapper);
            context.addServletMapping(urlPattern, servletName);

            host.addChild(context);
            context.create();
        } catch (Exception e) {
            throw MESSAGES.createContextPhaseFailed(e);
        }
        try {
            context.start();
        } catch (LifecycleException e) {
            throw MESSAGES.startContextPhaseFailed(e);
        }
        return context;
    }
View Full Code Here

        deployment.addAttachment(StandardContext.class, startWebApp(host, unit)); //TODO simplify and use findChild later in destroy()/stopWebApp()
        return deployment.getService().getEndpoints();
    }

    private static StandardContext startWebApp(Host host, WSEndpointDeploymentUnit unit) throws Exception {
        StandardContext context = new StandardContext();
        try {
            JBossWebMetaData jbwebMD = unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY);
            context.setPath(jbwebMD.getContextRoot());
            context.addLifecycleListener(new ContextConfig());
            ServerConfigService config = (ServerConfigService)unit.getServiceRegistry().getService(WSServices.CONFIG_SERVICE).getService();
            File docBase = new File(config.getValue().getServerTempDir(), jbwebMD.getContextRoot());
            if (!docBase.exists()) {
                docBase.mkdirs();
            }
            context.setDocBase(docBase.getPath());

            final Loader loader = new WebCtxLoader(unit.getAttachment(WSAttachmentKeys.CLASSLOADER_KEY));
            loader.setContainer(host);
            context.setLoader(loader);
            context.setInstanceManager(new LocalInstanceManager());

            addServlets(jbwebMD, context);

            host.addChild(context);
            context.create();
        } catch (Exception e) {
            throw MESSAGES.createContextPhaseFailed(e);
        }
        try {
            context.start();
        } catch (LifecycleException e) {
            throw MESSAGES.startContextPhaseFailed(e);
        }
        return context;
    }
View Full Code Here

    private final InjectedValue<String> pathInjector = new InjectedValue<String>();
    private final InjectedValue<VirtualHost> hostInjector = new InjectedValue<VirtualHost>();
    private final InjectedValue<HttpManagement> httpManagementInjector = new InjectedValue<HttpManagement>();

    public WelcomeContextService() {
        this.context = new StandardContext();
    }
View Full Code Here

        engine.setName("jboss.web");
        engine.setJvmRoute(jvmRoute);
        Host host = new MockHost();
        host.setName("localhost");
        engine.addChild(host);
        StandardContext context = new StandardContext();
        context.setName(warName);
        context.setDomain(jvmRoute);
        host.addChild(context);

        try {
            DistributableSessionManager<OutgoingDistributableSessionData> manager = new DistributableSessionManager<OutgoingDistributableSessionData>(factory, context, metaData, new ContextClassResolver()) {
                @Override
                public void start() throws LifecycleException {
                    try {
                        jvmRouteCache.start();
                        registry.start(mock(StartContext.class));
                        super.start();
                    } catch (Exception e) {
                        throw new IllegalStateException(e);
                    }
                }

                @Override
                public void stop() throws LifecycleException {
                    try {
                        super.stop();
                        if (jvmRouteCache.getStatus().allowInvocations()) {
                            registry.stop(mock(StopContext.class));
                            jvmRouteCache.stop();
                        }
                    } catch (Exception e) {
                        throw new IllegalStateException(e);
                    }
                }
            };

            context.setManager(manager);

            // Do this after assigning the manager to the container, or else
            // the container's setting will override ours
            // Can't just set the container as their config is per minute not per second
            manager.setMaxInactiveInterval(maxInactiveInterval);
View Full Code Here

        Engine engine = new MockEngine();
        engine.setName("jboss.web");
        Host host = new MockHost();
        host.setName("localhost");
        engine.addChild(host);
        StandardContext context = new StandardContext();
        context.setName("test");
        host.addChild(context);
       
        DistributableSessionManager<?> mgr = new DistributableSessionManager<OutgoingDistributableSessionData>(new MockDistributedCacheManagerFactory(), context, SessionTestUtil.createWebMetaData(10), new ContextClassResolver());
        context.setManager(mgr);
        mgr.start();

        mgr.getReplicationConfig().setReplicationGranularity(ReplicationGranularity.SESSION);
        ClusteredSession<?> sess = (ClusteredSession<?>) mgr.createEmptySession();
        assertTrue(sess.isOutdated());
View Full Code Here

TOP

Related Classes of org.apache.catalina.core.StandardContext$DummyAnnotationProcessor

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.