Examples of HttpConnectionFactory


Examples of org.eclipse.jetty.server.HttpConnectionFactory

    public HTTPSPDYServerConnector(Server server, HttpConfiguration config, SslContextFactory sslContextFactory, Map<Short, PushStrategy> pushStrategies)
    {
        super(server, AbstractConnectionFactory.getFactories(sslContextFactory,
                sslContextFactory == null
                        ? new ConnectionFactory[]{new HttpConnectionFactory(config)}
                        : new ConnectionFactory[]{new NPNServerConnectionFactory("spdy/3", "spdy/2", "http/1.1"),
                        new HttpConnectionFactory(config),
                        new HTTPSPDYServerConnectionFactory(SPDY.V3, config, getPushStrategy(SPDY.V3, pushStrategies)),
                        new HTTPSPDYServerConnectionFactory(SPDY.V2, config, getPushStrategy(SPDY.V2, pushStrategies))}));
        NPNServerConnectionFactory npnConnectionFactory = getConnectionFactory(NPNServerConnectionFactory.class);
        if (npnConnectionFactory != null)
            npnConnectionFactory.setDefaultProtocol("http/1.1");
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

    @Before
    public void setUp() throws Exception
    {
        HttpConfiguration http_config = new HttpConfiguration();
        http_config.setOutputBufferSize(4096);
        _connector = new ServerConnector(_server,new HttpConnectionFactory(http_config));
       
        _server.setConnectors(new Connector[]{ _connector });
        ServletContextHandler context = new ServletContextHandler();
        context.setContextPath("/ctx");
        _server.setHandler(context);
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

        server.addBean(mbContainer);


        // === jetty-http.xml ===
        ServerConnector http = new ServerConnector(server,
                new HttpConnectionFactory(http_config));
        http.setPort(8080);
        http.setIdleTimeout(30000);
        server.addConnector(http);


        // === jetty-https.xml ===
        // SSL Context Factory
        SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore");
        sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
        sslContextFactory.setTrustStorePath(jetty_home + "/etc/keystore");
        sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA",
                "SSL_DHE_RSA_WITH_DES_CBC_SHA", "SSL_DHE_DSS_WITH_DES_CBC_SHA",
                "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
                "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
                "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
                "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");

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

        // SSL Connector
        ServerConnector sslConnector = new ServerConnector(server,
            new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()),
            new HttpConnectionFactory(https_config));
        sslConnector.setPort(8443);
        server.addConnector(sslConnector);


        // === jetty-deploy.xml ===
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

                    @Override
                    protected void leaked(LeakDetector.LeakInfo leakInfo)
                    {
                        leaks.incrementAndGet();
                    }
                }, 1, Math.min(1, cores / 2), AbstractConnectionFactory.getFactories(sslContextFactory, new HttpConnectionFactory()));
        server.addConnector(connector);
        server.start();

        client.stop();
        HttpClient newClient = new HttpClient(new HttpClientTransportOverHTTP()
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

        // A plain HTTP connector listening on port 8080. Note that it's also
        // possible to have port 8080 configured as a non SSL SPDY connector.
        // But the specification and most browsers do not allow to use SPDY
        // without SSL encryption. However some browsers allow it to be
        // configured.
        HttpConnectionFactory http = new HttpConnectionFactory(config);
        ServerConnector httpConnector = new ServerConnector(server, http);
        httpConnector.setPort(8080);
        httpConnector.setIdleTimeout(10000);
        server.addConnector(httpConnector);

        // SSL configurations

        // We need a SSLContextFactory for the SSL encryption. That
        // SSLContextFactory will be used by the SPDY
        // connector.
        SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore");
        sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
        sslContextFactory.setTrustStorePath(jetty_home + "/etc/keystore");
        sslContextFactory.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        sslContextFactory.setExcludeCipherSuites(
                "SSL_RSA_WITH_DES_CBC_SHA",
                "SSL_DHE_RSA_WITH_DES_CBC_SHA",
                "SSL_DHE_DSS_WITH_DES_CBC_SHA",
                "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
                "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
                "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
                "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");

        // Spdy Connector

        // Make sure that the required NPN implementations are available.
        NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();

        // A ReferrerPushStrategy is being initialized.
        // See:
        // http://www.eclipse.org/jetty/documentation/current/spdy-configuring-push.html
        // for more details.
        PushStrategy push = new ReferrerPushStrategy();
        HTTPSPDYServerConnectionFactory spdy2 =
                new HTTPSPDYServerConnectionFactory(2, config, push);
        spdy2.setInputBufferSize(8192);
        spdy2.setInitialWindowSize(32768);

        // We need a connection factory per protocol that our server is supposed
        // to support on the NPN port. We then
        // create a ServerConnector and pass in the supported factories. NPN
        // will then be used to negotiate the
        // protocol with the client.
        HTTPSPDYServerConnectionFactory spdy3 =
                new HTTPSPDYServerConnectionFactory(3, config, push);
        spdy3.setInputBufferSize(8192);

        NPNServerConnectionFactory npn = new NPNServerConnectionFactory(
                spdy3.getProtocol(), spdy2.getProtocol(), http.getProtocol());
        npn.setDefaultProtocol(http.getProtocol());
        npn.setInputBufferSize(1024);

        SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,
                npn.getProtocol());
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

        }

        _server = new Server();
        _config = new HttpConfiguration();
        _config.setOutputBufferSize(2048);
        _connector = new ServerConnector(_server,new HttpConnectionFactory(_config));

        _server.setConnectors(new Connector[] { _connector });

        _resourceHandler = new ResourceHandler();
        _resourceHandler.setMinAsyncContentLength(4096);
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

        // Setup HTTP Configuration
        HttpConfiguration httpConf = new HttpConfiguration();
        httpConf.setSecurePort(securePort);
        httpConf.setSecureScheme("https");

        ServerConnector httpConnector = new ServerConnector(server,new HttpConnectionFactory(httpConf));
        httpConnector.setName("unsecured");
        httpConnector.setPort(port);

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

        ServerConnector httpsConnector = new ServerConnector(server,new SslConnectionFactory(sslContextFactory,"http/1.1"),new HttpConnectionFactory(httpsConf));
        httpsConnector.setName("secured");
        httpsConnector.setPort(securePort);

        // Add connectors
        server.setConnectors(new Connector[] { httpConnector, httpsConnector });
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

        http_config.setSecureScheme("https");
        http_config.setSecurePort(8443);

        // HTTP connector
        ServerConnector http = new ServerConnector(server,
                new HttpConnectionFactory(http_config));       
        http.setPort(8080);
        server.addConnector(http);
        // SSL Context Factory for HTTPS and SPDY
        SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setKeyStorePath(jetty_home + "/etc/keystore");
        sslContextFactory.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        sslContextFactory.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");

        // HTTPS Configuration
        HttpConfiguration https_config = new HttpConfiguration(http_config);
        https_config.addCustomizer(new SecureRequestCustomizer());
       
        // SPDY versions
        HTTPSPDYServerConnectionFactory spdy2 =
                new HTTPSPDYServerConnectionFactory(2, https_config);

        HTTPSPDYServerConnectionFactory spdy3 =
                new HTTPSPDYServerConnectionFactory(3, https_config,
                        new ReferrerPushStrategy());

        // NPN Factory
        NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
        NPNServerConnectionFactory npn = new NPNServerConnectionFactory(
                spdy3.getProtocol(),
                spdy2.getProtocol(),
                http.getDefaultProtocol());
        npn.setDefaultProtocol(http.getDefaultProtocol());

        // SSL Factory
        SslConnectionFactory ssl = new SslConnectionFactory(
                sslContextFactory, npn.getProtocol());

        // SPDY Connector
        ServerConnector spdyConnector = new ServerConnector(server, ssl,
                npn, spdy3, spdy2,
                new HttpConnectionFactory(https_config));
        spdyConnector.setPort(8443);
        server.addConnector(spdyConnector);
       
        // Set a handler
        server.setHandler(new HelloHandler());
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

        File keyStore = MavenTestingUtils.getTestResourceFile("keystore.jks");
        sslContextFactory = new SslContextFactory();
        sslContextFactory.setKeyStorePath(keyStore.getAbsolutePath());
        sslContextFactory.setKeyStorePassword("storepwd");

        HttpConnectionFactory httpFactory = new HttpConnectionFactory()
        {
            @Override
            public Connection newConnection(Connector connector, EndPoint endPoint)
            {
                return configure(new HttpConnection(getHttpConfiguration(), connector, endPoint, true)
                {
                    @Override
                    protected HttpParser newHttpParser()
                    {
                        return new HttpParser(newRequestHandler(), getHttpConfiguration().getRequestHeaderSize())
                        {
                            @Override
                            public boolean parseNext(ByteBuffer buffer)
                            {
                                httpParses.incrementAndGet();
                                return super.parseNext(buffer);
                            }
                        };
                    }

                    @Override
                    protected boolean onReadTimeout()
                    {
                        final Runnable idleHook = SslBytesServerTest.this.idleHook;
                        if (idleHook != null)
                            idleHook.run();
                        return super.onReadTimeout();
                    }
                }, connector, endPoint);
            }
        };
        httpFactory.getHttpConfiguration().addCustomizer(new SecureRequestCustomizer());
        SslConnectionFactory sslFactory = new SslConnectionFactory(sslContextFactory, httpFactory.getProtocol())
        {
            @Override
            protected SslConnection newSslConnection(Connector connector, EndPoint endPoint, SSLEngine engine)
            {
                return new SslConnection(connector.getByteBufferPool(), connector.getExecutor(), endPoint, engine)
View Full Code Here

Examples of org.eclipse.jetty.server.HttpConnectionFactory

    private HttpClient client;

    public void prepare(Handler handler) throws Exception
    {
        server = new Server();
        connector = new ServerConnector(server, new CAFEBABEServerConnectionFactory(new HttpConnectionFactory()));
        server.addConnector(connector);
        server.setHandler(handler);
        server.start();

        QueuedThreadPool executor = new QueuedThreadPool();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.