Package org.apache.catalina

Examples of org.apache.catalina.Context.addLifecycleListener()


          ctx.setConfigFile(contextFileURL);
        }
      }

      // Shutdown tomcat if a failure occurs during startup
      ctx.addLifecycleListener(new LifecycleListener() {
        @Override
        public void lifecycleEvent(LifecycleEvent event) {
          if (event.getLifecycle().getState() == LifecycleState.FAILED) {
            ((StandardServer) tomcat.getServer()).stopAwait();
          }
View Full Code Here


    for (ContextResource res : contextResources) {
      ctx.getNamingResources().addResource(res);
    }

    if (removeDefaultServlet) {
      ctx.addLifecycleListener(new LifecycleListener() {
        @Override
        public void lifecycleEvent(LifecycleEvent event) {
          if (Lifecycle.BEFORE_START_EVENT.equals(event.getType())) {
            ctx.removeServletMapping("/");
          }
View Full Code Here

    public Context addContext(Host host, String contextPath, String dir) {
        silence(contextPath);
        Context ctx = new StandardContext();
        ctx.setPath( contextPath );
        ctx.setDocBase(dir);
        ctx.addLifecycleListener(new FixContextListener());
       
        if (host == null) {
            getHost().addChild(ctx);
        } else {
            host.addChild(ctx);
View Full Code Here

        if (defaultRealm == null) {
            initSimpleAuth();
        }
        ctx.setRealm(defaultRealm);

        ctx.addLifecycleListener(new DefaultWebXmlListener());
       
        ContextConfig ctxCfg = new ContextConfig();
        ctx.addLifecycleListener(ctxCfg);
       
        // prevent it from looking ( if it finds one - it'll have dup error )
View Full Code Here

        ctx.setRealm(defaultRealm);

        ctx.addLifecycleListener(new DefaultWebXmlListener());
       
        ContextConfig ctxCfg = new ContextConfig();
        ctx.addLifecycleListener(ctxCfg);
       
        // prevent it from looking ( if it finds one - it'll have dup error )
        ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
       
        if (host == null) {
View Full Code Here

            context.setPath(contextPath);
            context.setDocBase(app.toString());
            clazz = Class.forName(configClass);
            LifecycleListener listener =
                (LifecycleListener) clazz.newInstance();
            context.addLifecycleListener(listener);
            host.addChild(context);
        } catch (Exception e) {
            host.getLogger().error(sm.getString("userConfig.error", user), e);
        }
View Full Code Here

            }

            Class<?> clazz = Class.forName(host.getConfigClass());
            LifecycleListener listener =
                (LifecycleListener) clazz.newInstance();
            context.addLifecycleListener(listener);

            context.setConfigFile(contextXml.toURI().toURL());
            context.setName(cn.getName());
            context.setPath(cn.getPath());
            context.setWebappVersion(cn.getVersion());
View Full Code Here

            }

            Class<?> clazz = Class.forName(host.getConfigClass());
            LifecycleListener listener =
                (LifecycleListener) clazz.newInstance();
            context.addLifecycleListener(listener);

            context.setName(cn.getName());
            context.setPath(cn.getPath());
            context.setWebappVersion(cn.getVersion());
            context.setDocBase(file);
View Full Code Here

            }

            Class<?> clazz = Class.forName(host.getConfigClass());
            LifecycleListener listener =
                (LifecycleListener) clazz.newInstance();
            context.addLifecycleListener(listener);

            context.setName(cn.getName());
            context.setPath(cn.getPath());
            context.setWebappVersion(cn.getVersion());
            context.setDocBase(file);
View Full Code Here

    public Context addContext(Host host, String contextPath, String dir) {
        silence(contextPath);
        Context ctx = new StandardContext();
        ctx.setPath( contextPath );
        ctx.setDocBase(dir);
        ctx.addLifecycleListener(new FixContextListener());
       
        if (host == null) {
            getHost().addChild(ctx);
        } else {
            host.addChild(ctx);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.