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.setConnectors(new Connector[] { connector }); httpServer.setThreadPool(threadPool); httpServer.setSendServerVersion(false); httpServer.setSendDateHeader(false); Context context = new Context(httpServer, "/", Context.NO_SESSIONS);
public void setServerName(String name) { if (name == null || name.trim().length() == 0) { jetty.setSendServerVersion(false); servlet.setServerName(null); } else { servlet.setServerName(name); } }
public ServletTester() { try { _server.setSendServerVersion(false); _server.addConnector(_connector); _server.addHandler(_context); } catch (Error e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
server.setThreadPool(threadPool); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true);
server.setSendServerVersion(sendServerVersion); server.start();
server.setSendServerVersion(sendServerVersion); server.start();
server.setThreadPool(threadPool); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true);
@Override protected void startUp() throws Exception { // setup the jetty config ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.packages", "com.twitter.hraven.rest"); sh.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true"); server = new Server(); Connector connector = new SelectChannelConnector(); connector.setPort(this.port); connector.setHost(address); server.addConnector(connector); // TODO: in the future we may want to provide settings for the min and max threads // Jetty sets the default max thread number to 250, if we don't set it. // QueuedThreadPool threadPool = new QueuedThreadPool(); server.setThreadPool(threadPool); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true); // set up context Context context = new Context(server, "/", Context.SESSIONS); context.addServlet(sh, "/*"); // start server server.start(); }
@Override protected void startUp() throws Exception { // setup the jetty config ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.packages", "com.twitter.hraven.rest"); sh.setInitParameter(JSONConfiguration.FEATURE_POJO_MAPPING, "true"); server = new Server(); Connector connector = new SelectChannelConnector(); connector.setPort(this.port); connector.setHost(address); server.addConnector(connector); // TODO: in the future we may want to provide settings for the min and max threads // Jetty sets the default max thread number to 250, if we don't set it. // QueuedThreadPool threadPool = new QueuedThreadPool(); server.setThreadPool(threadPool); server.setSendServerVersion(false); server.setSendDateHeader(false); server.setStopAtShutdown(true); // set up context Context context = new Context(server, "/", Context.SESSIONS); context.addServlet(sh, "/*"); // start server server.start(); }
public synchronized static void startServices() throws Exception { if (server == null) { /* * Setup the configuration service server */ server = new Server(); SocketConnector connector = new SocketConnector(); HTTPPort = AvailablePortFinder.getNextAvailable( 1024 ); connector.setPort(HTTPPort); WebAppContext context = new WebAppContext("src/test/resources/webapp", "/"); server.setSendServerVersion(false); server.addConnector(connector); server.addHandler(context); server.start(); txsServiceURL = "http://localhost:" + HTTPPort + "/"; } }