Search in sources :

Example 71 with HandlerCollection

use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.

the class AegisServer method run.

protected void run() {
    // System.out.println("Starting Server");
    server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
    WebAppContext webappcontext = new WebAppContext();
    String contextPath = null;
    try {
        contextPath = getClass().getResource("/webapp").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();
    }
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) HandlerCollection(org.eclipse.jetty.server.handler.HandlerCollection) URISyntaxException(java.net.URISyntaxException) URISyntaxException(java.net.URISyntaxException) DefaultHandler(org.eclipse.jetty.server.handler.DefaultHandler)

Example 72 with HandlerCollection

use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.

the class AbstractSpringServer method run.

protected void run() {
    server = new org.eclipse.jetty.server.Server(port);
    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath(contextPath);
    String warPath = null;
    try {
        warPath = getClass().getResource(resourcePath).toURI().getPath();
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }
    webappcontext.setWar(warPath);
    HandlerCollection handlers = new HandlerCollection();
    handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() });
    server.setHandler(handlers);
    try {
        configureServer(server);
        server.start();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) HandlerCollection(org.eclipse.jetty.server.handler.HandlerCollection) URISyntaxException(java.net.URISyntaxException) URISyntaxException(java.net.URISyntaxException) DefaultHandler(org.eclipse.jetty.server.handler.DefaultHandler)

Example 73 with HandlerCollection

use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.

the class AtomBookServer method run.

protected void run() {
    server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
    WebAppContext webappcontext = new WebAppContext();
    String contextPath = null;
    try {
        contextPath = getClass().getResource("/jaxrs_atom").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();
    }
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) HandlerCollection(org.eclipse.jetty.server.handler.HandlerCollection) URISyntaxException(java.net.URISyntaxException) URISyntaxException(java.net.URISyntaxException) DefaultHandler(org.eclipse.jetty.server.handler.DefaultHandler)

Example 74 with HandlerCollection

use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.

the class NioBookStoreServer method run.

protected void run() {
    server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
    WebAppContext webappcontext = new WebAppContext();
    String contextPath = null;
    try {
        contextPath = getClass().getResource("/jaxrs_nio").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();
    }
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) HandlerCollection(org.eclipse.jetty.server.handler.HandlerCollection) URISyntaxException(java.net.URISyntaxException) URISyntaxException(java.net.URISyntaxException) DefaultHandler(org.eclipse.jetty.server.handler.DefaultHandler)

Example 75 with HandlerCollection

use of org.eclipse.jetty.server.handler.HandlerCollection in project cxf by apache.

the class ResolverTest method startServer.

@Test
public void startServer() throws Throwable {
    Server server = new org.eclipse.jetty.server.Server(Integer.parseInt(PORT));
    WebAppContext webappcontext = new WebAppContext();
    webappcontext.setContextPath("/resolver");
    URL res = getClass().getResource("/resolver");
    String warPath = res.toURI().getPath();
    webappcontext.setWar(warPath);
    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();
}
Also used : WebAppContext(org.eclipse.jetty.webapp.WebAppContext) Server(org.eclipse.jetty.server.Server) HandlerCollection(org.eclipse.jetty.server.handler.HandlerCollection) URL(java.net.URL) DefaultHandler(org.eclipse.jetty.server.handler.DefaultHandler) Test(org.junit.Test)

Aggregations

HandlerCollection (org.eclipse.jetty.server.handler.HandlerCollection)76 DefaultHandler (org.eclipse.jetty.server.handler.DefaultHandler)44 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)30 ContextHandlerCollection (org.eclipse.jetty.server.handler.ContextHandlerCollection)27 Server (org.eclipse.jetty.server.Server)26 URISyntaxException (java.net.URISyntaxException)18 ServerConnector (org.eclipse.jetty.server.ServerConnector)18 RequestLogHandler (org.eclipse.jetty.server.handler.RequestLogHandler)18 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)16 Handler (org.eclipse.jetty.server.Handler)15 Test (org.junit.Test)13 ContextHandler (org.eclipse.jetty.server.handler.ContextHandler)9 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)9 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)8 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)7 GzipHandler (org.eclipse.jetty.servlets.gzip.GzipHandler)6 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)6 File (java.io.File)5 URI (java.net.URI)5 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)5