Java Code Examples for org.eclipse.jetty.server.Server#getBean()

The following examples show how to use org.eclipse.jetty.server.Server#getBean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelloWebServerServlet.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void main(String[] args) throws Exception
{
    Server server = new Server(8080);
    ServerConnector connector = server.getBean(ServerConnector.class);
    HttpConfiguration config = connector.getBean(HttpConnectionFactory.class).getHttpConfiguration();
    config.setSendDateHeader(true);
    config.setSendServerVersion(true);

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.NO_SECURITY|ServletContextHandler.NO_SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);

    context.addServlet(org.eclipse.jetty.servlet.DefaultServlet.class,"/");
    context.addServlet(JsonServlet.class,"/json");
    context.addServlet(PlaintextServlet.class,"/plaintext");

    server.start();
    server.join();
}
 
Example 2
Source File: ArmeriaConnector.java    From armeria with Apache License 2.0 5 votes vote down vote up
ArmeriaConnector(Server server, com.linecorp.armeria.server.Server armeriaServer) {
    super(server, -1, -1, new ArmeriaConnectionFactory());

    this.armeriaServer = armeriaServer;

    final HttpConfiguration httpConfig = server.getBean(HttpConfiguration.class);
    this.httpConfig = httpConfig != null ? httpConfig : new HttpConfiguration();
    addBean(this.httpConfig);

    setDefaultProtocol(PROTOCOL_NAME);
}
 
Example 3
Source File: HelloWebServer.java    From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] args) throws Exception
{
    Server server = new Server(8080);
    ServerConnector connector = server.getBean(ServerConnector.class);
    HttpConfiguration config = connector.getBean(HttpConnectionFactory.class).getHttpConfiguration();
    config.setSendDateHeader(true);
    config.setSendServerVersion(true);

    PathHandler pathHandler = new PathHandler();
    server.setHandler(pathHandler);

    server.start();
    server.join();
}