Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.HttpConnectionFactory


        final ThreadPool threadPool = new InstrumentedQueuedThreadPool(REGISTRY);
        final Server server = new Server(threadPool);

        final Connector connector = new ServerConnector(server,
                                                        new InstrumentedConnectionFactory(new HttpConnectionFactory(),
                                                                                          REGISTRY.timer("http.connection")));
        server.addConnector(connector);

        final ServletContextHandler context = new ServletContextHandler();
        context.setContextPath("/initial");
View Full Code Here


          .getWebPort());
      // httpConf.setOutputBufferSize(32768);

      // HTTP connector
      final ServerConnector http = new ServerConnector(server,
          new HttpConnectionFactory(httpConf));
      http.setHost(actorExtractor.extract().getHost().getWebHostLocal());
      http.setPort(actorExtractor.extract().getHost().getWebPortLocal());
      // http.setIdleTimeout(30000);

      // HTTPS Configuration
      final HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
      httpsConf.addCustomizer(new SecureRequestCustomizer());

      // HTTPS connector
      final ServerConnector https = new ServerConnector(server,
          new SslConnectionFactory(sslCnxt, "http/1.1"),
          new HttpConnectionFactory(httpsConf));
      https.setHost(actorExtractor.extract().getHost().getWebHost());
      https.setPort(actorExtractor.extract().getHost().getWebPort());

      server.setConnectors(new Connector[] { http, https });
View Full Code Here

    HttpConfiguration http_config = new HttpConfiguration();
    http_config.setSecureScheme("https");
    http_config.setSecurePort(8443);
    http_config.setOutputBufferSize(32768);

    ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
    http.setPort(8080);
    http.setIdleTimeout(1000 * 60 * 60);

    server.addConnector(http);

    Resource keystore = Resource.newClassPathResource("/keystore");
    if (keystore != null && keystore.exists())
    {
      // if a keystore for a SSL certificate is available, start a SSL
      // connector on port 8443.
      // By default, the quickstart comes with a Apache Wicket Quickstart
      // Certificate that expires about half way september 2021. Do not
      // use this certificate anywhere important as the passwords are
      // available in the source.

      SslContextFactory sslContextFactory = new SslContextFactory();
      sslContextFactory.setKeyStoreResource(keystore);
      sslContextFactory.setKeyStorePassword("wicket");
      sslContextFactory.setKeyManagerPassword("wicket");

      HttpConfiguration https_config = new HttpConfiguration(http_config);
      https_config.addCustomizer(new SecureRequestCustomizer());

      ServerConnector https = new ServerConnector(server, new SslConnectionFactory(
        sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config));
      https.setPort(8443);
      https.setIdleTimeout(500000);

      server.addConnector(https);
      System.out.println("SSL access to the examples has been enabled on port 8443");
View Full Code Here

    http_config.setResponseHeaderSize(8192);
    http_config.setSendServerVersion(true);
    http_config.setSendDateHeader(false);

    Server server = new Server();
    ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));

    // Set some timeout options to make debugging easier.
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.addConnector(connector);

    Resource keystore = Resource.newClassPathResource("/keystore");
    if (keystore != null && keystore.exists()) {
      // if a keystore for a SSL certificate is available, start a SSL
      // connector on port 8443.
      // By default, the quickstart comes with a Apache Wicket Quickstart
      // Certificate that expires about half way september 2021. Do not
      // use this certificate anywhere important as the passwords are
      // available in the source.

      SslContextFactory factory = new SslContextFactory();
      factory.setKeyStoreResource(keystore);
      factory.setKeyStorePassword("wicket");
      factory.setTrustStoreResource(keystore);
      factory.setKeyManagerPassword("wicket");

      // SSL HTTP Configuration
      HttpConfiguration https_config = new HttpConfiguration(http_config);
      https_config.addCustomizer(new SecureRequestCustomizer());

      // SSL Connector
      ServerConnector sslConnector = new ServerConnector(server,
          new SslConnectionFactory(factory,"http/1.1"),
          new HttpConnectionFactory(https_config));
      sslConnector.setPort(8443);
      server.addConnector(sslConnector);

      System.out.println("SSL access to the quickstart has been enabled on port 8443");
      System.out.println("You can access the application using SSL on https://localhost:8443");
View Full Code Here

public class Start
{
  public static void main(String[] args)
  {
    Server server = new Server();
    ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
    // Set some timeout options to make debugging easier.
    connector.setIdleTimeout(1000 * 60 * 60);
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.setConnectors(new Connector[] {connector});
View Full Code Here

    http_config.setResponseHeaderSize(8192);
    http_config.setSendServerVersion(true);
    http_config.setSendDateHeader(false);

    Server server = new Server();
    ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));

    // Set some timeout options to make debugging easier.
//        connector.setMaxIdleTime(timeout);
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.addConnector(connector);

    Resource keystore = Resource.newClassPathResource("/keystore");
    if (keystore != null && keystore.exists()) {
      // if a keystore for a SSL certificate is available, start a SSL
      // connector on port 8443.
      // By default, the quickstart comes with a Apache Wicket Quickstart
      // Certificate that expires about half way september 2021. Do not
      // use this certificate anywhere important as the passwords are
      // available in the source.

      SslContextFactory factory = new SslContextFactory();
      factory.setKeyStoreResource(keystore);
      factory.setKeyStorePassword("wicket");
      factory.setTrustStoreResource(keystore);
      factory.setKeyManagerPassword("wicket");

      // SSL HTTP Configuration
      HttpConfiguration https_config = new HttpConfiguration(http_config);
      https_config.addCustomizer(new SecureRequestCustomizer());

      // SSL Connector
      ServerConnector sslConnector = new ServerConnector(server,
          new SslConnectionFactory(factory,"http/1.1"),
          new HttpConnectionFactory(https_config));
      sslConnector.setPort(8443);
      server.addConnector(sslConnector);

      System.out.println("SSL access to the quickstart has been enabled on port 8443");
      System.out.println("You can access the application using SSL on https://localhost:8443");
View Full Code Here

        // (SSL) access
        httpConfig.setSecurePort(this.httpsPort);
      }
      httpConfig.setOutputBufferSize(32768);
      ServerConnector http = new ServerConnector(server,
          new HttpConnectionFactory(httpConfig));
      http.setPort(this.httpPort);

      server.addConnector(http);
    }

    // set up HTTPS connector with SSL key store (and optionally a trust
    // store)
    if (this.httpsPort != null) {
      checkArgument(this.sslKeyStoreType != null,
          "https configuration missing key store type is null");
      checkArgument(this.sslKeyStorePath != null,
          "https configuration missing SSL key store path");
      checkArgument(this.sslKeyStorePassword != null,
          "https configuration missing SSL key store password");

      SslContextFactory sslContextFactory = new SslContextFactory();
      sslContextFactory.setKeyStoreType(this.sslKeyStoreType.name());
      sslContextFactory.setKeyStorePath(this.sslKeyStorePath);
      sslContextFactory.setKeyStorePassword(this.sslKeyStorePassword);
      if (this.sslKeyPassword != null) {
        sslContextFactory.setKeyManagerPassword(this.sslKeyPassword);
      } else {
        sslContextFactory
            .setKeyManagerPassword(this.sslKeyStorePassword);
      }

      if (this.sslTrustStorePath != null) {
        checkArgument(this.sslTrustStoreType != null,
            "missing trust store type for trust store");
        checkArgument(this.sslTrustStorePassword != null,
            "missing password for trust store");

        sslContextFactory.setTrustStoreType(this.sslTrustStoreType
            .name());
        sslContextFactory.setTrustStorePath(this.sslTrustStorePath);
        sslContextFactory
            .setTrustStorePassword(this.sslTrustStorePassword);
      }
      if (this.sslRequireClientCert) {
        checkArgument(this.sslTrustStorePath != null,
            "Client certificate authentication specified without "
                + "specifying a trust store");
        checkArgument(this.sslTrustStorePassword != null,
            "Client certificate authentication specified without "
                + "specifying a trust store password");
      }
      // if true: requires client to authenticate with certificate
      sslContextFactory.setNeedClientAuth(this.sslRequireClientCert);
      // if true: authenticates client certificate if provided
      sslContextFactory.setWantClientAuth(false);

      // HTTPS config
      HttpConfiguration httpsConfig = new HttpConfiguration();
      httpsConfig.addCustomizer(new SecureRequestCustomizer());
      httpsConfig.setOutputBufferSize(32768);
      // HTTPS connector
      ServerConnector https = new ServerConnector(server,
          new SslConnectionFactory(sslContextFactory, "http/1.1"),
          new HttpConnectionFactory(httpsConfig));
      https.setPort(this.httpsPort);

      server.addConnector(https);
    }
View Full Code Here

        httpConfig.setSecurePort(params.securePort);
      }
          httpConfig.setSendServerVersion(false);
          httpConfig.setSendDateHeader(false);

      ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
      connector.setSoLingerTime(-1);
      connector.setIdleTimeout(30000);
      connector.setPort(params.port);
      String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
      if (!StringUtils.isEmpty(bindInterface)) {
View Full Code Here

        httpConfig.setSecurePort(params.securePort);
      }
          httpConfig.setSendServerVersion(false);
          httpConfig.setSendDateHeader(false);

      ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
      connector.setSoLingerTime(-1);
      connector.setIdleTimeout(30000);
      connector.setPort(params.port);
      String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
      if (!StringUtils.isEmpty(bindInterface)) {
View Full Code Here

    @Override
    protected ServerConnector buildConnector( Server server, HttpConfiguration httpConfig )
    {
        SslConnectionFactory sslConnFactory = new SslConnectionFactory();
        configureSsl( sslConnFactory, configuration.get() );
        return new ServerConnector( server, sslConnFactory, new HttpConnectionFactory( httpConfig ) );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.server.HttpConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.