Search in sources :

Example 46 with Server

use of org.eclipse.jetty.server.Server in project jetty.project by eclipse.

the class AbstractConnectHandlerTest method prepareProxy.

protected void prepareProxy() throws Exception {
    proxy = new Server();
    proxyConnector = new ServerConnector(proxy);
    proxy.addConnector(proxyConnector);
    connectHandler = new ConnectHandler();
    proxy.setHandler(connectHandler);
    proxy.start();
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) Server(org.eclipse.jetty.server.Server)

Example 47 with Server

use of org.eclipse.jetty.server.Server in project jetty.project by eclipse.

the class BalancerServletTest method createServer.

private Server createServer(ServletHolder servletHolder, String nodeName) {
    Server server = new Server();
    ServerConnector connector = new ServerConnector(server);
    server.addConnector(connector);
    ServletContextHandler context = new ServletContextHandler(server, CONTEXT_PATH, ServletContextHandler.SESSIONS);
    context.addServlet(servletHolder, SERVLET_PATH + "/*");
    if (nodeName != null) {
        DefaultSessionIdManager sessionIdManager = new DefaultSessionIdManager(server);
        sessionIdManager.setWorkerName(nodeName);
        server.setSessionIdManager(sessionIdManager);
    }
    return server;
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) DefaultSessionIdManager(org.eclipse.jetty.server.session.DefaultSessionIdManager) Server(org.eclipse.jetty.server.Server) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Example 48 with Server

use of org.eclipse.jetty.server.Server in project jetty.project by eclipse.

the class ConnectHandlerTest method prepare.

@Before
public void prepare() throws Exception {
    server = new Server();
    serverConnector = new ServerConnector(server);
    server.addConnector(serverConnector);
    server.setHandler(new ServerHandler());
    server.start();
    prepareProxy();
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) Server(org.eclipse.jetty.server.Server) Before(org.junit.Before)

Example 49 with Server

use of org.eclipse.jetty.server.Server in project jetty.project by eclipse.

the class ProxyServletTest method startServer.

private void startServer(HttpServlet servlet) throws Exception {
    QueuedThreadPool serverPool = new QueuedThreadPool();
    serverPool.setName("server");
    server = new Server(serverPool);
    serverConnector = new ServerConnector(server);
    server.addConnector(serverConnector);
    ServletContextHandler appCtx = new ServletContextHandler(server, "/", true, false);
    ServletHolder appServletHolder = new ServletHolder(servlet);
    appCtx.addServlet(appServletHolder, "/*");
    server.start();
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) Server(org.eclipse.jetty.server.Server) QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Example 50 with Server

use of org.eclipse.jetty.server.Server in project jetty.project by eclipse.

the class ReverseProxyTest method startServer.

private void startServer(HttpServlet servlet) throws Exception {
    server = new Server();
    serverConnector = new ServerConnector(server);
    server.addConnector(serverConnector);
    ServletContextHandler appCtx = new ServletContextHandler(server, "/", true, false);
    ServletHolder appServletHolder = new ServletHolder(servlet);
    appCtx.addServlet(appServletHolder, "/*");
    server.start();
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) Server(org.eclipse.jetty.server.Server) ServletHolder(org.eclipse.jetty.servlet.ServletHolder) ServletContextHandler(org.eclipse.jetty.servlet.ServletContextHandler)

Aggregations

Server (org.eclipse.jetty.server.Server)577 ServerConnector (org.eclipse.jetty.server.ServerConnector)217 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)143 Test (org.junit.Test)119 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)113 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)75 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)73 IOException (java.io.IOException)71 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)67 WebAppContext (org.eclipse.jetty.webapp.WebAppContext)67 File (java.io.File)65 URI (java.net.URI)56 Before (org.junit.Before)50 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)49 BeforeClass (org.junit.BeforeClass)48 ServletException (javax.servlet.ServletException)45 Connector (org.eclipse.jetty.server.Connector)42 LocalConnector (org.eclipse.jetty.server.LocalConnector)42 URL (java.net.URL)39 HttpServletRequest (javax.servlet.http.HttpServletRequest)39