Search in sources :

Example 1 with SslSocketConnector

use of org.mortbay.jetty.security.SslSocketConnector in project Honu by jboulon.

the class ThriftJettyCollector method main.

public static void main(String[] args) throws Exception {
    Configuration conf = HonuConfigurationFactory.getInstance().getCollectorConfiguration();
    THREADS = conf.getInt("chukwaCollector.http.threads", THREADS);
    // Set up jetty connector
    int portNum = conf.getInt("chukwaCollector.http.port", 9999);
    SelectChannelConnector jettyConnector = new SelectChannelConnector();
    jettyConnector.setLowResourcesConnections(THREADS - 10);
    jettyConnector.setLowResourceMaxIdleTime(1500);
    jettyConnector.setPort(portNum);
    int sslPortNum = conf.getInt("chukwaCollector.https.port", 9998);
    SslSocketConnector sslConnector = new SslSocketConnector();
    sslConnector.setPort(sslPortNum);
    sslConnector.setMaxIdleTime(1500);
    sslConnector.setKeystore(conf.get("chukwaCollector.keystore"));
    sslConnector.setTruststore(conf.get("chukwaCollector.truststore"));
    sslConnector.setPassword(conf.get("chukwaCollector.password"));
    sslConnector.setKeyPassword(conf.get("chukwaCollector.keyPassword"));
    sslConnector.setTrustPassword(conf.get("chukwaCollector.trustPassword"));
    // Set up jetty server proper, using connector
    jettyServer = new Server(portNum);
    jettyServer.setConnectors(new Connector[] { jettyConnector, sslConnector });
    org.mortbay.thread.BoundedThreadPool pool = new org.mortbay.thread.BoundedThreadPool();
    pool.setMaxThreads(THREADS);
    jettyServer.setThreadPool(pool);
    // Add the collector servlet to server
    Context root = new Context(jettyServer, "/", Context.SESSIONS);
    root.addServlet(new ServletHolder(new ThriftServletCollector()), "/*");
    jettyServer.start();
    jettyServer.setStopAtShutdown(true);
}
Also used : SslSocketConnector(org.mortbay.jetty.security.SslSocketConnector) Configuration(org.apache.hadoop.conf.Configuration) Server(org.mortbay.jetty.Server) SelectChannelConnector(org.mortbay.jetty.nio.SelectChannelConnector) ThriftServletCollector(org.honu.datacollection.collector.servlet.ThriftServletCollector)

Example 2 with SslSocketConnector

use of org.mortbay.jetty.security.SslSocketConnector in project sonatype-aether by sonatype.

the class HttpServer method newHttpsConnector.

protected Connector newHttpsConnector() {
    SslSocketConnector connector = new SslSocketConnector();
    connector.setPort(httpsPort);
    connector.setKeystore(new File(keyStoreLocation).getAbsolutePath());
    connector.setPassword(keyStorePassword);
    connector.setKeyPassword(keyStorePassword);
    connector.setTruststore(new File(trustStoreLocation).getAbsolutePath());
    connector.setTrustPassword(trustStorePassword);
    connector.setNeedClientAuth(needClientAuth);
    return connector;
}
Also used : SslSocketConnector(org.mortbay.jetty.security.SslSocketConnector) File(java.io.File)

Example 3 with SslSocketConnector

use of org.mortbay.jetty.security.SslSocketConnector in project maven-plugins by apache.

the class ProjectInfoReportUtilsTest method getSSLConnector.

private Connector getSSLConnector() {
    SslSocketConnector connector = new SslSocketConnector();
    connector.setKeystore(getBasedir() + "/target/jetty.jks");
    connector.setPassword("apache");
    connector.setKeyPassword("apache");
    connector.setTruststore(getBasedir() + "/target/jetty.jks");
    connector.setTrustPassword("apache");
    return connector;
}
Also used : SslSocketConnector(org.mortbay.jetty.security.SslSocketConnector)

Aggregations

SslSocketConnector (org.mortbay.jetty.security.SslSocketConnector)3 File (java.io.File)1 Configuration (org.apache.hadoop.conf.Configuration)1 ThriftServletCollector (org.honu.datacollection.collector.servlet.ThriftServletCollector)1 Server (org.mortbay.jetty.Server)1 SelectChannelConnector (org.mortbay.jetty.nio.SelectChannelConnector)1