Exemplo n.º 1
0
  public Context addContext(Host host, String contextPath, String contextName, String dir) {
    silence(host, contextPath);
    Context ctx = new StandardContext();
    ctx.setName(contextName);
    ctx.setPath(contextPath);
    ctx.setDocBase(dir);
    ctx.addLifecycleListener(new FixContextListener());

    if (host == null) {
      getHost().addChild(ctx);
    } else {
      host.addChild(ctx);
    }
    return ctx;
  }
Exemplo n.º 2
0
  public Context addWebapp(Host host, String url, String name, String path) {
    silence(host, url);

    Context ctx = new StandardContext();
    ctx.setName(name);
    ctx.setPath(url);
    ctx.setDocBase(path);

    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(noDefaultWebXmlPath());

    if (host == null) {
      getHost().addChild(ctx);
    } else {
      host.addChild(ctx);
    }

    return ctx;
  }