Package org.eclipse.jetty.webapp

Examples of org.eclipse.jetty.webapp.WebAppContext


        sslContextFactory.setTrustStorePassword(super.getTrustStorePassword());
        sslContextFactory.setNeedClientAuth(super.getRequireClientCert());
        SslSelectChannelConnector httpsConnector = new SslSelectChannelConnector(sslContextFactory);
        httpsConnector.setPort(super.getHttpsPort());

        WebAppContext webAppContext = new WebAppContext();
        webAppContext.setContextPath(this.getContextPath());
        webAppContext.setWar(this.getWebAppDir());
        webAppContext.getSessionHandler().getSessionManager().setMaxInactiveInterval(super.getSessionTimeout() * 60);
        LOGGER.info("getMaxInactiveInterval() is %d seconds", webAppContext.getSessionHandler().getSessionManager().getMaxInactiveInterval());

        ContextHandlerCollection contexts = new ContextHandlerCollection();
        contexts.setHandlers(new Handler[]{webAppContext});

        server = new org.eclipse.jetty.server.Server();
View Full Code Here


    for (Entry<String, File> entry : wars.entrySet()) {
      String contextPath = entry.getKey();
      File war = entry.getValue();

      WebAppContext context = new WebAppContext();
      context.setWar(war.getAbsolutePath());
      context.setContextPath(contextPath);

      context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");

      context.addFilter(GwtCacheHeaderFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));

      contexts.addHandler(context);
    }

    server.setHandler(contexts);
View Full Code Here

        connector.setIdleTimeout(1000 * 60 * 60);
        connector.setSoLingerTime(-1);
        connector.setPort(PORT);
        server.setConnectors(new Connector[] {connector});

        WebAppContext bb = new WebAppContext();
        bb.setServer(server);
        bb.setContextPath(SOMEPATH);
        bb.setWar("src/test/webapp");

        server.setHandler(bb);

        new Thread(new Runnable() {
            @Override
View Full Code Here

   */
  public void start() throws Exception {
   
    server = new Server(port);
   
    WebAppContext context = new WebAppContext();
    context.setContextPath("/");
   
    File file = new File(basePath, "webapp");
    URI uri = file.toURI();
   
    context.setWar(uri.toString());
   
    HandlerList list = new HandlerList();
    list.addHandler(context);
    list.addHandler(new DefaultHandler());
   
View Full Code Here

    }

    public void start(int port) throws Exception {
        LOG.warn("Port used: " + port + " location " + WEBAPP_LOCATION + " " + databaseInfo.toString());
        server = new Server(port);
        WebAppContext root = new WebAppContext();
        root.setContextPath("/");
        root.setDescriptor(WEBAPP_LOCATION + "/WEB-INF/web.xml");
        root.setResourceBase(WEBAPP_LOCATION);
        root.setParentLoaderPriority(true);
        root.setAttribute(ConsoleFilter.DATABASE_ATTRIBUTE, databaseInfo);
        final HandlerList handlers = new HandlerList();
        // don't remove, needed for neo4j.org proxy
        final Handler resourceHandler = createResourceHandler("/console_assets", WEBAPP_LOCATION);
        handlers.setHandlers(new Handler[]{resourceHandler,root});
        server.setHandler(handlers);
View Full Code Here

        server.start();
    }


    private Handler createResourceHandler(String context, String resourceBase) {
        WebAppContext ctx = new WebAppContext();
        ctx.setContextPath(context);
        ctx.setResourceBase(resourceBase);
        ctx.setParentLoaderPriority(true);
        return ctx;
    }
View Full Code Here

        connector.setPort(8080);

    server.setConnectors(new Connector[]{connector});

    WebAppContext context = new WebAppContext();
    context.setContextPath("/");
        context.setResourceBase(System.getProperty("user.dir"));
    context.setInitParameter(SessionManager.__CheckRemoteSessionEncoding, "true"); // Stops Jetty from adding 'jsessionid' URL rewriting into non-local URLs (e.g. Google OpenId redirects)

    server.setHandler(context);

    server.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener()
    {
View Full Code Here

    connector.setMaxIdleTime(1000 * 60 * 60);
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.setConnectors(new Connector[] { connector });

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/");
    bb.setWar("src/main/webapp");

    server.setHandler(bb);

    try
    {
View Full Code Here

      System.out.println("SSL access to the examples has been enabled on port 8443");
      System.out.println("You can access the application using SSL on https://localhost:8443");
      System.out.println();
    }

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/");
    bb.setWar("src/main/webapp");

    // uncomment next line if you want to test with JSESSIONID encoded in the urls
    // ((AbstractSessionManager) bb.getSessionHandler().getSessionManager()).setUsingCookies(false);

    server.setHandler(bb);
View Full Code Here

   
    //Initialize Alfresco Server bindings
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    alfrescoServer.setHandler(contexts);

    WebAppContext alfrescoServerApi = new WebAppContext(alfrescoServerWarPath,"/alfresco");
    alfrescoServerApi.setParentLoaderPriority(false);
    HashLoginService dummyLoginService = new HashLoginService("TEST-SECURITY-REALM");
    alfrescoServerApi.getSecurityHandler().setLoginService(dummyLoginService);
    contexts.addHandler(alfrescoServerApi);
   
    Class h2DataSource = Thread.currentThread().getContextClassLoader().loadClass("org.h2.jdbcx.JdbcDataSource");
    Object o = h2DataSource.newInstance();
    String jdbcUrl = "jdbc:h2:.alf_data_jetty/h2_data/alf_jetty";
    String jdbcUsername = "alfresco";
    String jdbcPassword = "alfresco";
    String jdbcJndiName = "jdbc/dataSource";
    h2DataSource.getMethod("setURL", new Class[] {String.class}).invoke(o, new Object[] {jdbcUrl});
    h2DataSource.getMethod("setUser", new Class[] {String.class}).invoke(o, new Object[] {jdbcUsername});
    h2DataSource.getMethod("setPassword", new Class[] {String.class}).invoke(o, new Object[] {jdbcPassword});
   
    Resource jdbcResource = new Resource(jdbcJndiName, o);
   
    alfrescoServer.start();
    boolean entered = false;
   
    while(alfrescoServer.isStarted()
        && alfrescoServerApi.isStarted()
        && !entered){
      entered = true;
      Thread.sleep(5000);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.webapp.WebAppContext

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.