public JettySolandraRunner( String context, int port, String host) { this.context = context; server = new Server( port ); server.getConnectors()[0].setHost(host); server.setStopAtShutdown( true ); // Initialize the servlets Context root = new Context( server, context, Context.SESSIONS ); // for some reason, there must be a servlet for this to get applied root.addServlet( Servlet404.class, "/*" ); dispatchFilter = root.addFilter( SolandraDispatchFilter.class, "*", Handler.REQUEST ); }
public static Context getJettyServer(String clusterXml, String storesXml, String storeName, RequestFormatType requestFormat, int port) throws Exception { StoreRepository repository = getStores(storeName, clusterXml, storesXml); // initialize servlet Server server = new Server(port); server.setSendServerVersion(false); Context context = new Context(server, "/", Context.NO_SESSIONS); RequestHandler handler = getSocketRequestHandlerFactory(clusterXml, storesXml, repository).getRequestHandler(requestFormat); context.addServlet(new ServletHolder(new StoreServlet(handler)), "/stores"); server.start(); return context; }
httpServer.setSendServerVersion(false); httpServer.setSendDateHeader(false); Context context = new Context(httpServer, "/", Context.NO_SESSIONS); context.setAttribute(VoldemortServletContextListener.SERVER_KEY, server); context.setAttribute(VoldemortServletContextListener.VELOCITY_ENGINE_KEY,
public ExhibitorMain(BackupProvider backupProvider, ConfigProvider configProvider, ExhibitorArguments.Builder builder, int httpPort, String listenAddress, SecurityHandler security, SecurityArguments securityArguments) throws Exception { HashUserRealm realm = makeRealm(securityArguments); if ( securityArguments.getRemoteAuthSpec() != null ) { addRemoteAuth(builder, securityArguments.getRemoteAuthSpec()); } builder.shutdownProc(makeShutdownProc(this)); exhibitor = new Exhibitor(configProvider, null, backupProvider, builder.build()); exhibitor.start(); DefaultResourceConfig application = JerseySupport.newApplicationConfig(new UIContext(exhibitor)); ServletContainer container = new ServletContainer(application); server = new Server(); SocketConnector http = new SocketConnector(); http.setHost(listenAddress); http.setPort(httpPort); server.addConnector(http); Context root = new Context(server, "/", Context.SESSIONS); root.addFilter(ExhibitorServletFilter.class, "/", Handler.ALL); root.addServlet(new ServletHolder(container), "/*"); if ( security != null ) { root.setSecurityHandler(security); } else if ( securityArguments.getSecurityFile() != null ) { addSecurityFile(realm, securityArguments.getSecurityFile(), root); } }
private Context getContext(HandlerContainer pContainer, MuleAgentConfig pConfig) { Context root = new Context(pContainer, "/jolokia", Context.SESSIONS); if (pConfig.getUser() != null && pConfig.getPassword() != null) { root.setSecurityHandler(getSecurityHandler(pConfig.getUser(), pConfig.getPassword(), "jolokia-role")); } return root; }
this.props.getString("web.resource.dir", DEFAULT_STATIC_DIR); logger.info("Setting up web resource dir " + staticDir); final Context root = new Context(this.server, "/", Context.SESSIONS); root.setMaxFormContentSize(MAX_FORM_CONTENT_SIZE);
@Before public final void beforeTest() throws Exception { Assert.assertFalse(this.httpRoot.exists()); Assert.assertTrue(this.httpRoot.mkdirs()); Context context = new Context(this.server, "/", Context.SESSIONS); context.setBaseResource(new FileResource(new URL("file://" + this.httpRoot.getAbsolutePath()))); context.setContextPath("/"); context.addServlet(new ServletHolder(new DefaultServlet()), "/*"); this.server.setHandler(context); this.server.start(); }
@Inject public JettyServer( int portNumber ) { server = new Server( portNumber ); context = new Context( server, "/", Context.SESSIONS ); context.addFilter( GuiceFilter.class, "/*", 0 ); context.addServlet( DefaultServlet.class, "/" ); }
/** Starts a server on the named port. */ public HttpServer(ResponderServlet servlet, int port) throws IOException { this.server = new org.mortbay.jetty.Server(port); new Context(server,"/").addServlet(new ServletHolder(servlet), "/*"); try { server.start(); } catch (Exception e) { throw new AvroRuntimeException(e); } }
/** Constructs a server to run with the given connector. */ public HttpServer(ResponderServlet servlet, Connector connector) throws IOException { this.server = new org.mortbay.jetty.Server(); server.addConnector(connector); new Context(server, "/").addServlet(new ServletHolder(servlet), "/*"); }
public StatsServer(StatsPlugin plugin, int port) throws Exception { this.httpServer = new Server(port); this.plugin = plugin; Context staticContext = new Context(httpServer, "/static"); staticContext.addServlet(new ServletHolder(new StaticServlet()), "/"); Context context = new Context(httpServer, "/"); context.addServlet(new ServletHolder(new StatsServlet(plugin)), "/"); httpServer.start(); }
public StatsServer(StatsPlugin plugin, int port) throws Exception { this.httpServer = new Server(port); this.plugin = plugin; Context staticContext = new Context(httpServer, "/static"); staticContext.addServlet(new ServletHolder(new StaticServlet()), "/"); Context context = new Context(httpServer, "/"); context.addServlet(new ServletHolder(new StatsServlet(plugin)), "/"); httpServer.start(); }
private static void startServer(File inputDir, boolean gzip, int port) throws Exception { Server server = new Server(port); Context root = new Context(server, "/", Context.SESSIONS); root.addServlet(new ServletHolder(new ClusterController(inputDir, gzip)), "/*"); server.start(); }
protected void createHttpServer() { final ContextHandlerCollection contexts; final ServletHolder servletHolder; final Context root; httpServer = new Server(port); contexts = new ContextHandlerCollection(); httpServer.setHandler(contexts); root = new Context(contexts, "/", Context.SESSIONS); servletHolder = new ServletHolder(new MainServlet()); servletHolder.setInitParameter("route_resolver", routeResolverClass().getName()); root.addServlet(servletHolder, "/*"); }
public void start(int port) throws Exception { server = new Server(port); context = new Context(server, "/", Context.SESSIONS); addServlets(); server.start(); }
public void start(int port) throws Exception { server = new Server(port); context = new Context(server, "/", Context.SESSIONS); addServlets(); server.start(); }
public void start(int port) throws Exception { server = new Server(port); context = new Context(server, "/", Context.SESSIONS); addServlets(); server.start(); }
private static Handler generateServletContextHandler() throws IOException { ServletHandler servletHandler = new ServletHandler(); servletHandler.addServletWithMapping(BlockingServlet.class, BLOCKING_PATH); servletHandler.addServletWithMapping(BlockingForwardServlet.class, BLOCKING_FORWARD_PATH); servletHandler.addFilterWithMapping(RequestTracingFilter.class.getName(), "/*", Handler.ALL); Context context = new Context(null, null, null, servletHandler, null); context.setContextPath("/"); return context; }
public WebHookTestProxyServer (String host, Integer port) { server = new Server(port); Context root = new Context(server,"/",Context.SESSIONS); root.addServlet(new ServletHolder(new ProxyServerServlet()), "/*"); }
public static Server startCollectorOnPort(Configuration conf, int port, ServletCollector collector) throws Exception { Server server = new Server(port); Context root = new Context(server, "/", Context.SESSIONS); root.addServlet(new ServletHolder(collector), "/*"); root.addServlet(new ServletHolder(new CommitCheckServlet(conf)), "/"+CommitCheckServlet.DEFAULT_PATH); server.start(); server.setStopAtShutdown(false); return server; }