org.eclipse.jetty.server.handler.DefaultHandler Java Examples

The following examples show how to use org.eclipse.jetty.server.handler.DefaultHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyServer.java    From pulsar with Apache License 2.0 6 votes vote down vote up
public void start() throws PulsarServerException {
    log.info("Starting web socket proxy at port {}", conf.getWebServicePort().get());
    RequestLogHandler requestLogHandler = new RequestLogHandler();
    Slf4jRequestLog requestLog = new Slf4jRequestLog();
    requestLog.setExtended(true);
    requestLog.setLogTimeZone(TimeZone.getDefault().getID());
    requestLog.setLogLatency(true);
    requestLogHandler.setRequestLog(requestLog);
    handlers.add(0, new ContextHandlerCollection());
    handlers.add(requestLogHandler);

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    contexts.setHandlers(handlers.toArray(new Handler[handlers.size()]));

    HandlerCollection handlerCollection = new HandlerCollection();
    handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler });
    server.setHandler(handlerCollection);

    try {
        server.start();
    } catch (Exception e) {
        throw new PulsarServerException(e);
    }
}
 
Example #2
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server() throws Exception {
    System.out.println("Starting Server");

    /**
     * Important: This code simply starts up a servlet container and adds
     * the web application in src/webapp to it. Normally you would be using
     * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
     * as a convenience so you do not need to configure your servlet
     * container to see CXF in action!
     */
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9002);

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/");

    webappcontext.setWar("target/JavaFirstSpringSupport.war");

    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

    server.setHandler(handlers);
    server.start();
    System.out.println("Server ready...");
    server.join();
}
 
Example #3
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server() throws Exception {
    System.out.println("Starting Server");

    /**
     * Important: This code simply starts up a servlet container and adds
     * the web application in src/webapp to it. Normally you would be using
     * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
     * as a convenience so you do not need to configure your servlet
     * container to see CXF in action!
     */
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9002);

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/");

    webappcontext.setWar("target/JAXRSSpringSecurity.war");

    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

    server.setHandler(handlers);
    server.start();
    System.out.println("Server ready...");
    server.join();
}
 
Example #4
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8080 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/jaxrs" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );


    server.start();
    server.join();
}
 
Example #5
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8080 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/jaxrs" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );


    server.start();
    server.join();
}
 
Example #6
Source File: EmbeddedServer.java    From xdocreport.samples with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main( String[] args )
    throws Exception
{
    Server server = new Server( 8080 );

    WebAppContext webappcontext = new WebAppContext( "src/main/webapp", "/jaxrs" );

    ContextHandlerCollection servlet_contexts = new ContextHandlerCollection();
    webappcontext.setClassLoader( Thread.currentThread().getContextClassLoader() );
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers( new Handler[] { servlet_contexts, webappcontext, new DefaultHandler() } );

    server.setHandler( handlers );


    server.start();
    server.join();
}
 
Example #7
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server() throws Exception {
    System.out.println("Starting Server");

    /**
     * Important: This code simply starts up a servlet container and adds
     * the web application in src/webapp to it. Normally you would be using
     * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
     * as a convenience so you do not need to configure your servlet
     * container to see CXF in action!
     */
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9002);

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/");

    webappcontext.setWar("target/GroovySpringSupport.war");

    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

    server.setHandler(handlers);
    server.start();
    System.out.println("Server ready...");
    server.join();
}
 
Example #8
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server() throws Exception {
    System.out.println("Starting Server");

    /**
     * Important: This code simply starts up a servlet container and adds
     * the web application in src/webapp to it. Normally you would be using
     * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
     * as a convenience so you do not need to configure your servlet
     * container to see CXF in action!
     */
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9002);

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/");

    webappcontext.setWar("target/RubySpringSupport.war");

    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

    server.setHandler(handlers);
    server.start();
    System.out.println("Server ready...");
    server.join();
}
 
Example #9
Source File: OAuthServer.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {

        server = new org.eclipse.jetty.server.Server(PORT);

        WebAppContext webappcontext = new WebAppContext();
        String contextPath = null;
        try {
            contextPath = getClass().getResource(RESOURCE_PATH).toURI().getPath();
        } catch (URISyntaxException e1) {
            e1.printStackTrace();
        }
        webappcontext.setContextPath("/");

        webappcontext.setWar(contextPath);

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

        server.setHandler(handlers);
        try {
            server.start();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
Example #10
Source File: AegisServer.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {
    //System.out.println("Starting Server");

    server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/");
    webappcontext.setBaseResource(Resource.newClassPathResource("/webapp"));

    server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));
    try {
        server.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}
 
Example #11
Source File: AbstractSpringServer.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {
    server = new org.eclipse.jetty.server.Server(port);

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath(contextPath);
    webappcontext.setBaseResource(Resource.newClassPathResource(resourcePath));

    server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));

    try {
        configureServer(server);
        server.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #12
Source File: ResolverTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void startServer() throws Throwable {
    Server server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/resolver");
    webappcontext.setBaseResource(Resource.newClassPathResource("/resolver"));

    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
    server.setHandler(handlers);
    server.start();
    Throwable e = webappcontext.getUnavailableException();
    if (e != null) {
        throw e;
    }
    server.stop();
}
 
Example #13
Source File: EmbeddedServer.java    From jaxrs with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	URI baseUri = UriBuilder.fromUri("http://localhost").port(SERVER_PORT)
			.build();
	ResourceConfig config = new ResourceConfig(Calculator.class);
	Server server = JettyHttpContainerFactory.createServer(baseUri, config,
			false);

	ContextHandler contextHandler = new ContextHandler("/rest");
	contextHandler.setHandler(server.getHandler());
	
	ProtectionDomain protectionDomain = EmbeddedServer.class
			.getProtectionDomain();
	URL location = protectionDomain.getCodeSource().getLocation();
	
	ResourceHandler resourceHandler = new ResourceHandler();
	resourceHandler.setWelcomeFiles(new String[] { "index.html" });
	resourceHandler.setResourceBase(location.toExternalForm());
	System.out.println(location.toExternalForm());
	HandlerCollection handlerCollection = new HandlerCollection();
	handlerCollection.setHandlers(new Handler[] { resourceHandler,
			contextHandler, new DefaultHandler() });
	server.setHandler(handlerCollection);
	server.start();
	server.join();
}
 
Example #14
Source File: DigestServer.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {
    server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/digestauth");
    webappcontext.setBaseResource(Resource.newClassPathResource("/digestauth"));

    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

    server.setHandler(handlers);

    try {
        configureServer();
        server.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #15
Source File: JAXRSClientServerWebSocketSpringWebAppNoAtmosphereTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected static void startServers(String port) throws Exception {
    server = new org.eclipse.jetty.server.Server(Integer.parseInt(port));

    WebAppContext webappcontext = new WebAppContext();
    String contextPath = null;
    try {
        contextPath = JAXRSClientServerWebSocketSpringWebAppTest.class
            .getResource("/jaxrs_websocket").toURI().getPath();
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }
    webappcontext.setContextPath("/webapp");

    webappcontext.setWar(contextPath);
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
    server.setHandler(handlers);
    server.start();
}
 
Example #16
Source File: JAXRSClientServerWebSocketSpringWebAppTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected static void startServers(String port) throws Exception {
    server = new org.eclipse.jetty.server.Server(Integer.parseInt(port));

    WebAppContext webappcontext = new WebAppContext();
    String contextPath = null;
    try {
        contextPath = JAXRSClientServerWebSocketSpringWebAppTest.class
            .getResource("/jaxrs_websocket").toURI().getPath();
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }
    webappcontext.setContextPath("/webapp");

    webappcontext.setWar(contextPath);
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
    server.setHandler(handlers);
    server.start();
}
 
Example #17
Source File: ServerManager.java    From pulsar with Apache License 2.0 6 votes vote down vote up
public void start() throws Exception {
    RequestLogHandler requestLogHandler = new RequestLogHandler();
    Slf4jRequestLog requestLog = new Slf4jRequestLog();
    requestLog.setExtended(true);
    requestLog.setLogTimeZone(TimeZone.getDefault().getID());
    requestLog.setLogLatency(true);
    requestLogHandler.setRequestLog(requestLog);
    handlers.add(0, new ContextHandlerCollection());
    handlers.add(requestLogHandler);

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    contexts.setHandlers(handlers.toArray(new Handler[handlers.size()]));

    HandlerCollection handlerCollection = new HandlerCollection();
    handlerCollection.setHandlers(new Handler[] { contexts, new DefaultHandler(), requestLogHandler });
    server.setHandler(handlerCollection);

    server.start();

    log.info("Server started at end point {}", getServiceUri());
}
 
Example #18
Source File: AbstractSpringServer.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {
    server = new org.eclipse.jetty.server.Server(port);

    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath(contextPath);
    webappcontext.setBaseResource(Resource.newClassPathResource(resourcePath));

    server.setHandler(new HandlerCollection(webappcontext, new DefaultHandler()));

    try {
        configureServer(server);
        server.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #19
Source File: PackageManagerCLITest.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public void start() throws Exception {
  server = new Server();

  connector = new ServerConnector(server);
  connector.setPort(port);
  server.addConnector(connector);
  server.setStopAtShutdown(true);

  ResourceHandler resourceHandler = new ResourceHandler();
  resourceHandler.setResourceBase(resourceDir);
  resourceHandler.setDirectoriesListed(true);

  HandlerList handlers = new HandlerList();
  handlers.setHandlers(new Handler[] {resourceHandler, new DefaultHandler()});
  server.setHandler(handlers);

  server.start();
}
 
Example #20
Source File: CompletionServer.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Starts the server.
 * 
 * @param host
 *            the host to listen
 * @param port
 *            the port to listen
 * @throws Exception
 *             if the server can't be started
 */
public void start(String host, int port) throws Exception {
    server = new Server();

    @SuppressWarnings("resource")
    final ServerConnector connector = new ServerConnector(server);
    connector.setPort(port);
    connector.setHost(host);
    server.setConnectors(new Connector[] {connector });

    final ServletHandler servletHandler = new ServletHandler();
    server.setHandler(servletHandler);
    servletHandler.addServletWithMapping(AddInServlet.class, "/*");

    final HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] {servletHandler, new DefaultHandler() });
    server.setHandler(handlers);

    server.start();
}
 
Example #21
Source File: CustomAuthHttpServerTest.java    From calcite-avatica with Apache License 2.0 6 votes vote down vote up
@Override public void customize(Server server) {
  HttpServer avaticaServer = getAvaticaServer();

  HandlerFactory factory = new HandlerFactory();
  Handler avaticaHandler = factory.getHandler(service,
          Driver.Serialization.PROTOBUF, null, configuration);

  if (isBasicAuth) {
    ConstraintSecurityHandler securityHandler =
            avaticaServer.configureBasicAuthentication(server, configuration);
    securityHandler.setHandler(avaticaHandler);
    avaticaHandler = securityHandler;
  }

  HandlerList handlerList = new HandlerList();
  handlerList.setHandlers(new Handler[] { avaticaHandler, new DefaultHandler()});
  server.setHandler(handlerList);
}
 
Example #22
Source File: HttpServer.java    From calcite-avatica with Apache License 2.0 6 votes vote down vote up
private HandlerList configureHandlers() {
  final HandlerList handlerList = new HandlerList();
  Handler avaticaHandler = handler;

  // Wrap the provided handler for security if we made one
  if (null != config) {
    ConstraintSecurityHandler securityHandler = getSecurityHandler();
    securityHandler.setHandler(handler);
    avaticaHandler = securityHandler;
  }

  handlerList.setHandlers(new Handler[] {avaticaHandler, new DefaultHandler()});

  server.setHandler(handlerList);
  return handlerList;
}
 
Example #23
Source File: DashBoardServer.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
public void prepare() {
    try {
        Tools.verifyLocalPort("DBServer ", port());
        server = new Server();
        DefaultHandler webHandler = new DefaultHandler();
        HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[]{getResourceHandler(),
            getUIWSHandler(), webHandler});

        ServerConnector connector = new ServerConnector(server);
        connector.setPort(port());
        server.setConnectors(new Connector[]{connector});
        server.setHandler(handlers);

        LOG.log(Level.INFO, "DB Server on : http://{0}:{1}",
                new Object[]{Tools.IP(), port() + ""});

    } catch (Exception ex) {
        LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
}
 
Example #24
Source File: GraphQlServer.java    From rejoiner with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
  // Embedded Jetty server
  Server server = new Server(HTTP_PORT);
  ResourceHandler resourceHandler = new ResourceHandler();
  resourceHandler.setWelcomeFiles(new String[] {"index.html"});
  resourceHandler.setDirectoriesListed(true);
  // resource base is relative to the WORKSPACE file
  resourceHandler.setResourceBase("./src/main/resources");
  HandlerList handlerList = new HandlerList();
  handlerList.setHandlers(
      new Handler[] {resourceHandler, new GraphQlHandler(), new DefaultHandler()});
  server.setHandler(handlerList);
  server.start();
  logger.info("Server running on port " + HTTP_PORT);
  server.join();
}
 
Example #25
Source File: ApplicationServer.java    From rest-utils with Apache License 2.0 6 votes vote down vote up
private void finalizeHandlerCollection(HandlerCollection handlers, HandlerCollection wsHandlers) {
  /* DefaultHandler must come last eo ensure all contexts
   * have a chance to handle a request first */
  handlers.addHandler(new DefaultHandler());
  /* Needed for graceful shutdown as per `setStopTimeout` documentation */
  StatisticsHandler statsHandler = new StatisticsHandler();
  statsHandler.setHandler(handlers);

  ContextHandlerCollection contexts = new ContextHandlerCollection();
  contexts.setHandlers(new Handler[]{
      statsHandler,
      wsHandlers
  });

  super.setHandler(wrapWithGzipHandler(contexts));
}
 
Example #26
Source File: TestSupport.java    From p3-batchrefine with Apache License 2.0 5 votes vote down vote up
private int startTransformServer() throws Exception {
    URL transforms = EngineTest.class.getClassLoader().getResource(
            "transforms");
    if (transforms == null) {
        Assert.fail();
    }

    int port = findFreePort();

    Server fileServer = new Server(port);

    ResourceHandler handler = new ResourceHandler();
    MimeTypes mimeTypes = handler.getMimeTypes();
    mimeTypes.addMimeMapping("json", "application/json; charset=UTF-8");

    handler.setDirectoriesListed(true);
    handler.setBaseResource(JarResource.newResource(transforms));

    HandlerList handlers = new HandlerList();
    handlers.addHandler(handler);
    handlers.addHandler(new DefaultHandler());

    fileServer.setHandler(handlers);
    fileServer.start();

    return port;
}
 
Example #27
Source File: RemoteRepositoryConnectivityCheckTest.java    From archiva with Apache License 2.0 5 votes vote down vote up
protected Server buildStaticServer( Path path )
{
    Server repoServer = new Server(  );

    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setDirectoriesListed( true );
    resourceHandler.setWelcomeFiles( new String[]{ "index.html" } );
    resourceHandler.setResourceBase( path.toAbsolutePath().toString() );

    HandlerList handlers = new HandlerList();
    handlers.setHandlers( new Handler[]{ resourceHandler, new DefaultHandler() } );
    repoServer.setHandler( handlers );

    return repoServer;
}
 
Example #28
Source File: Server.java    From maven-framework-project with MIT License 5 votes vote down vote up
protected Server() throws Exception {

        System.out.println("Starting Server");

        /**
         * Important: This code simply starts up a servlet container and adds
         * the web application in src/webapp to it. Normally you would be using
         * Jetty or Tomcat and have the webapp packaged as a WAR. This is simply
         * as a convenience so you do not need to configure your servlet
         * container to see CXF in action!
         */
        org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server();

        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(8080);
        server.setConnectors(new Connector[] {connector});

        WebAppContext webappcontext = new WebAppContext();
        webappcontext.setContextPath("/");

        webappcontext.setWar("D:\\developer\\workspace\\maven-framework-project\\cxf-soap-ws\\target\\cxf-soap-ws.war");

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

        server.setHandler(handlers);
        server.start();
        System.out.println("Server ready...");
        server.join();
    }
 
Example #29
Source File: JettyServer.java    From jbake with MIT License 5 votes vote down vote up
/**
 * Run Jetty web server serving out supplied path on supplied port
 *
 * @param path Base directory for resourced to be served
 * @param port Required server port
 */
public void run(String path, String port) {
    Server server = new Server();
    ServerConnector connector = new ServerConnector(server);
    connector.setHost("localhost");
    connector.setPort(Integer.parseInt(port));
    server.addConnector(connector);

    ResourceHandler resource_handler = new ResourceHandler();
    resource_handler.setDirectoriesListed(true);
    resource_handler.setWelcomeFiles(new String[]{"index.html"});

    resource_handler.setResourceBase(path);

    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[]{resource_handler, new DefaultHandler()});
    server.setHandler(handlers);

    LOGGER.info("Serving out contents of: [{}] on http://localhost:{}/", path, port);
    LOGGER.info("(To stop server hit CTRL-C)");

    try {
        server.start();
        server.join();
    } catch (Exception e) {
        LOGGER.error("unable to start server", e);
    }
}
 
Example #30
Source File: ReportOpen.java    From allure1 with Apache License 2.0 5 votes vote down vote up
/**
 * Set up server for report directory.
 */
private Server setUpServer() {
    Server server = new Server(port);
    ResourceHandler handler = new ResourceHandler();
    handler.setDirectoriesListed(true);
    handler.setWelcomeFiles(new String[]{"index.html"});
    handler.setResourceBase(getReportDirectoryPath().toAbsolutePath().toString());
    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[]{handler, new DefaultHandler()});
    server.setStopAtShutdown(true);
    server.setHandler(handlers);
    return server;
}