use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class AsyncListenerTest method startServer.
public void startServer(ServletContextHandler context) throws Exception {
server = threadPool == null ? new Server() : new Server(threadPool);
connector = new LocalConnector(server);
connector.setIdleTimeout(20 * 60 * 1000L);
server.addConnector(connector);
server.setHandler(context);
server.start();
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class InvokerTest method init.
@Before
public void init() throws Exception {
_server = new Server();
_connector = new LocalConnector(_server);
_connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
_connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendDateHeader(false);
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
_server.addConnector(_connector);
_server.setHandler(context);
context.setContextPath("/");
ServletHolder holder = context.addServlet(Invoker.class, "/servlet/*");
holder.setInitParameter("nonContextServlets", "true");
_server.start();
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class DispatcherTest method init.
@Before
public void init() throws Exception {
_server = new Server();
_connector = new LocalConnector(_server);
_connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
_connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendDateHeader(false);
_contextCollection = new ContextHandlerCollection();
_contextHandler = new ServletContextHandler();
_contextHandler.setContextPath("/context");
_contextCollection.addHandler(_contextHandler);
_resourceHandler = new ResourceHandler();
_resourceHandler.setResourceBase(MavenTestingUtils.getTestResourceDir("dispatchResourceTest").getAbsolutePath());
_resourceHandler.setPathInfoOnly(true);
ContextHandler resourceContextHandler = new ContextHandler("/resource");
resourceContextHandler.setHandler(_resourceHandler);
_contextCollection.addHandler(resourceContextHandler);
_server.setHandler(_contextCollection);
_server.addConnector(_connector);
_server.start();
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class EncodedURITest method init.
@Before
public void init() throws Exception {
_server = new Server();
_connector = new LocalConnector(_server);
_connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
_connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendDateHeader(false);
_server.addConnector(_connector);
_contextCollection = new ContextHandlerCollection();
_server.setHandler(_contextCollection);
_context0 = new ServletContextHandler();
_context0.setContextPath("/context path");
_contextCollection.addHandler(_context0);
_context0.addFilter(AsyncFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
_context0.addServlet(TestServlet.class, "/test servlet/*");
_context0.addServlet(AsyncServlet.class, "/async servlet/*");
_context1 = new ServletContextHandler();
_context1.setContextPath("/redirecting context");
_contextCollection.addHandler(_context1);
_server.start();
}
use of org.eclipse.jetty.server.LocalConnector in project jetty.project by eclipse.
the class GzipHandlerTest method init.
@Before
public void init() throws Exception {
_server = new Server();
_connector = new LocalConnector(_server);
_server.addConnector(_connector);
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setExcludedAgentPatterns();
gzipHandler.setMinGzipSize(16);
gzipHandler.setInflateBufferSize(4096);
ServletContextHandler context = new ServletContextHandler(gzipHandler, "/ctx");
ServletHandler servlets = context.getServletHandler();
_server.setHandler(gzipHandler);
gzipHandler.setHandler(context);
servlets.addServletWithMapping(MicroServlet.class, "/micro");
servlets.addServletWithMapping(MicroChunkedServlet.class, "/microchunked");
servlets.addServletWithMapping(TestServlet.class, "/content");
servlets.addServletWithMapping(ForwardServlet.class, "/forward");
servlets.addServletWithMapping(IncludeServlet.class, "/include");
servlets.addServletWithMapping(EchoServlet.class, "/echo/*");
_server.start();
}
Aggregations