Package org.eclipse.jetty.server

Examples of org.eclipse.jetty.server.HttpConfiguration


    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);
View Full Code Here


          .getProvider().getName());
      sslCnxt.setIncludeProtocols(PROTOCOL_INCLUDE);
      sslCnxt.setTrustAll(false);

      // HTTP Configuration
      final HttpConfiguration httpConf = new HttpConfiguration();
      httpConf.setSecureScheme(HttpScheme.HTTPS.asString());
      httpConf.setSecurePort(actorExtractor.extract().getHost()
          .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));
View Full Code Here

  {
    System.setProperty("wicket.configuration", "development");

    Server server = new Server();

    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);
View Full Code Here

public class Start
{
  public static void main(String[] args) throws Exception
  {
    HttpConfiguration http_config = new HttpConfiguration();
    http_config.setSecureScheme("https");
    http_config.setSecurePort(8443);
    http_config.setOutputBufferSize(32768);
    http_config.setRequestHeaderSize(8192);
    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));
View Full Code Here

public class Start
{
  public static void main(String[] args) throws Exception
  {
    HttpConfiguration http_config = new HttpConfiguration();
    http_config.setSecureScheme("https");
    http_config.setSecurePort(8443);
    http_config.setOutputBufferSize(32768);
    http_config.setRequestHeaderSize(8192);
    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));
View Full Code Here

  public Server build() {
    Server server = new Server();

    // set up HTTP connector
    if (this.httpPort != null) {
      HttpConfiguration httpConfig = new HttpConfiguration();
      if (this.httpsPort != null) {
        httpConfig.setSecureScheme("https");
        // set redirect port for those pages requiring confidential
        // (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);
View Full Code Here

      /*
       * HTTP
       */
      logger.info("Setting up HTTP transport on port " + params.port);

      HttpConfiguration httpConfig = new HttpConfiguration();
      if (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) {
        httpConfig.setSecureScheme("https");
        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);
View Full Code Here

      /*
       * HTTP
       */
      logger.info("Setting up HTTP transport on port " + params.port);

      HttpConfiguration httpConfig = new HttpConfiguration();
      if (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) {
        httpConfig.setSecureScheme("https");
        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);
View Full Code Here

    }

    @Override
    protected HttpConfiguration specializeHttp( HttpConfiguration httpConfig )
    {
        HttpConfiguration httpsConfig = new HttpConfiguration( httpConfig );
        httpsConfig.addCustomizer( new SecureRequestCustomizer() );
        return httpsConfig;
    }
View Full Code Here

    {
        // Configure Server
        configureServer( server, configuration() );

        // Set up HTTP
        HttpConfiguration httpConfig = new HttpConfiguration();
        configureHttp( httpConfig, configuration() );
        httpConfig = specializeHttp( httpConfig );

        // Set up connector
        ServerConnector connector = buildConnector( server, httpConfig );
View Full Code Here

TOP

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

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.