Package org.eclipse.jetty.server.handler

Examples of org.eclipse.jetty.server.handler.ContextHandlerCollection


                            handlerCollection.addHandler(h);
                        }
                    }
                }
            }
            contexts = new ContextHandlerCollection();
            /*
             * handlerCollection may be null here if is only one handler to deal with.
             * Which in turn implies that there can't be a 'defaultHander' to deal with.
             */
            if (handlerCollection != null) {
View Full Code Here


        return camelServlet;
    }
   
    protected Server createServer() throws Exception {
        Server server = new Server();
        ContextHandlerCollection collection = new ContextHandlerCollection();
        server.setHandler(collection);

        // configure thread pool if min/max given
        if (minThreads != null || maxThreads != null) {
            if (getThreadPool() != null) {
View Full Code Here

        extensions.add(extension);
    }

    protected Server createServer() throws Exception {
        Server server = new Server();
        ContextHandlerCollection collection = new ContextHandlerCollection();
        server.setHandler(collection);
        return server;
    }
View Full Code Here

    } else {
      // We have more than one path served out of this container so
      // combine them in a handler which supports dispatching to the
      // individual contexts.
      //
      final ContextHandlerCollection r = new ContextHandlerCollection();
      r.setHandlers(all.toArray(new Handler[0]));
      return r;
    }
  }
View Full Code Here

    }
   
    /*
     * Create the collection of webapp contexts
     */
    ContextHandlerCollection contexts = new ContextHandlerCollection();
   
    /*
     * Loop through the webapps defined in the configuration
     */
    for (Map<String,Object> webappConfig : (List<Map<String,Object>>) config.get("webapps")) {
      try {
        WebAppContext webAppContext = new WebAppContext();
        webAppContext.setDisplayName((String) webappConfig.get("name"));
       
        String base = (String) config.get("webappBase");
       
        String contextPath = (String) webappConfig.get("contextPath");
        if (contextPath == null) contextPath = "";
        webAppContext.setContextPath("/" + contextPath);
       
        String filePath = ((base != null) ? base : "") + webappConfig.get("filePath");
        if (filePath.toLowerCase().endsWith(".war")) {
          webAppContext.setWar(filePath);
        } else {
          webAppContext.setResourceBase(filePath);
        }
       
        /*
         * Standard Jetty WebApp Configuration
         */
        webAppContext.setConfigurationClasses(new String[] {
              "org.eclipse.jetty.webapp.WebInfConfiguration",
              "org.eclipse.jetty.webapp.WebXmlConfiguration",
              "org.eclipse.jetty.webapp.MetaInfConfiguration",
              "org.eclipse.jetty.webapp.FragmentConfiguration",
              "org.eclipse.jetty.plus.webapp.EnvConfiguration",
              "org.eclipse.jetty.plus.webapp.PlusConfiguration",
              "org.eclipse.jetty.annotations.AnnotationConfiguration",
              "org.eclipse.jetty.webapp.JettyWebXmlConfiguration"
          });
       
        /*
         * Add the data sources
         */
        if (webappConfig.get("dataSource") != null) createDataSource(webAppContext, (Map<String, String>) webappConfig.get("dataSource"));
        if (webappConfig.get("dataSources") != null) {
          for (Map<String,String> dataSourceConfig : (List<Map<String,String>>) webappConfig.get("dataSources")) {
            createDataSource(webAppContext, dataSourceConfig);
          }
        }
       
        /*
         * Add the default jetty servlet
         */
        ServletHolder defaultServlet = new ServletHolder(new DefaultServlet());
        Map<String,String> params = new HashMap<String,String>();
        params.put("dirAllowed", "false");
        params.put("aliases", "true");
        params.put("acceptRanges", "true");
        params.put("welcomeServlets", "false");
        params.put("redirectWelcome", "false");
        params.put("maxCacheSize", "256000000");
        params.put("maxCachedFileSize", "20000000");
        params.put("maxCachedFiles", "2048");
        params.put("gzip", "true");
        params.put("useFileMappedBuffer", "true");
        params.put("resourceCache", "resourceCache");
        defaultServlet.setInitParameters(params);
        //defaultServlet.setInitOrder(0);
        webAppContext.addServlet(defaultServlet, "/");
       
        contexts.addHandler(webAppContext);
      } catch (Exception e) {
        String msg = "Error Configuring Webapp:\n" + e.getClass().getSimpleName() + "\n" + Arrays.toString(e.getStackTrace()).replaceAll(",", "\n");
        System.out.println(msg);
        log.warn(msg);
      }     
View Full Code Here

        extensions.add(extension);
    }

    protected Server createServer() throws Exception {
        Server server = new Server();
        ContextHandlerCollection collection = new ContextHandlerCollection();
        server.setHandler(collection);
        return server;
    }
View Full Code Here

  {
    cmisServer = new Server(port);
    cmisServer.setStopAtShutdown(true);

    //Initialize OpenCMIS Server bindings
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    cmisServer.setHandler(contexts);

    openCmisServerApi = new WebAppContext(warPath,"/chemistry-opencmis-server-inmemory");
    openCmisServerApi.setParentLoaderPriority(false);
    contexts.addHandler(openCmisServerApi);
  }
View Full Code Here

    if (System.getProperty("alfrescoServerWarPath") != null)
      alfrescoServerWarPath = System.getProperty("alfrescoServerWarPath");
   
    //Initialize Alfresco Server bindings
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    alfrescoServer.setHandler(contexts);

    WebAppContext alfrescoServerApi = new WebAppContext(alfrescoServerWarPath,"/alfresco");
    alfrescoServerApi.setParentLoaderPriority(false);
    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";
View Full Code Here

    if (System.getProperty("openCmisServerWarPath") != null)
      openCmisServerWarPath = System.getProperty("openCmisServerWarPath");
   
    //Initialize OpenCMIS Server bindings
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    cmisServer.setHandler(contexts);
    WebAppContext openCmisServerApi = new WebAppContext(openCmisServerWarPath,"/chemistry-opencmis-server-inmemory");
    openCmisServerApi.setParentLoaderPriority(false);
    contexts.addHandler(openCmisServerApi);
   
    System.out.println("OpenCMIS InMemory server is starting...");
    cmisServer.start();
    boolean entered = false;
   
View Full Code Here

  {
    server = new Server( port );   
    server.setStopAtShutdown( true );
   
    // Initialize the servlets
    ContextHandlerCollection contexts = new ContextHandlerCollection();
    server.setHandler(contexts);
    WebAppContext mcfCombined = new WebAppContext(combinedWarPath,"/mcf");
    mcfCombined.setParentLoaderPriority(false);
    contexts.addHandler(mcfCombined);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.handler.ContextHandlerCollection

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.