Search in sources :

Example 11 with HTTP2CServerConnectionFactory

use of org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory in project spring-boot by spring-projects.

the class JettyServletWebServerFactory method createConnector.

private AbstractConnector createConnector(InetSocketAddress address, Server server) {
    HttpConfiguration httpConfiguration = new HttpConfiguration();
    httpConfiguration.setSendServerVersion(false);
    List<ConnectionFactory> connectionFactories = new ArrayList<>();
    connectionFactories.add(new HttpConnectionFactory(httpConfiguration));
    if (getHttp2() != null && getHttp2().isEnabled()) {
        connectionFactories.add(new HTTP2CServerConnectionFactory(httpConfiguration));
    }
    ServerConnector connector = new ServerConnector(server, this.acceptors, this.selectors, connectionFactories.toArray(new ConnectionFactory[0]));
    connector.setHost(address.getHostString());
    connector.setPort(address.getPort());
    return connector;
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) HTTP2CServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) ConnectionFactory(org.eclipse.jetty.server.ConnectionFactory) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) HTTP2CServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory) ArrayList(java.util.ArrayList) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration)

Example 12 with HTTP2CServerConnectionFactory

use of org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory in project spring-boot by spring-projects.

the class JettyReactiveWebServerFactory method createConnector.

private AbstractConnector createConnector(InetSocketAddress address, Server server) {
    HttpConfiguration httpConfiguration = new HttpConfiguration();
    httpConfiguration.setSendServerVersion(false);
    List<ConnectionFactory> connectionFactories = new ArrayList<>();
    connectionFactories.add(new HttpConnectionFactory(httpConfiguration));
    if (getHttp2() != null && getHttp2().isEnabled()) {
        connectionFactories.add(new HTTP2CServerConnectionFactory(httpConfiguration));
    }
    JettyResourceFactory resourceFactory = getResourceFactory();
    ServerConnector connector;
    if (resourceFactory != null) {
        connector = new ServerConnector(server, resourceFactory.getExecutor(), resourceFactory.getScheduler(), resourceFactory.getByteBufferPool(), this.acceptors, this.selectors, connectionFactories.toArray(new ConnectionFactory[0]));
    } else {
        connector = new ServerConnector(server, this.acceptors, this.selectors, connectionFactories.toArray(new ConnectionFactory[0]));
    }
    connector.setHost(address.getHostString());
    connector.setPort(address.getPort());
    return connector;
}
Also used : ServerConnector(org.eclipse.jetty.server.ServerConnector) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) HTTP2CServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory) ConnectionFactory(org.eclipse.jetty.server.ConnectionFactory) JettyResourceFactory(org.springframework.http.client.reactive.JettyResourceFactory) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) HTTP2CServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory) ArrayList(java.util.ArrayList) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration)

Example 13 with HTTP2CServerConnectionFactory

use of org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory in project cxf by apache.

the class JettyHTTPServerEngine method createConnectorJetty.

AbstractConnector createConnectorJetty(SslContextFactory sslcf, String hosto, int porto, int major, int minor, final Bus bus) {
    final AbstractConnector result;
    try {
        HttpConfiguration httpConfig = new HttpConfiguration();
        httpConfig.setSendServerVersion(getSendServerVersion());
        HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig);
        Collection<ConnectionFactory> connectionFactories = new ArrayList<>();
        result = new org.eclipse.jetty.server.ServerConnector(server);
        if (tlsServerParameters != null) {
            httpConfig.addCustomizer(new org.eclipse.jetty.server.SecureRequestCustomizer());
            if (!isHttp2Enabled(bus)) {
                final SslConnectionFactory scf = new SslConnectionFactory(sslcf, httpFactory.getProtocol());
                connectionFactories.add(scf);
            } else {
                // The ALPN processors are application specific (as per Jetty docs) and are pluggable as
                // additional dependency.
                final ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();
                alpn.setDefaultProtocol(httpFactory.getProtocol());
                final SslConnectionFactory scf = new SslConnectionFactory(sslcf, alpn.getProtocol());
                connectionFactories.add(scf);
                connectionFactories.add(alpn);
                connectionFactories.add(new HTTP2ServerConnectionFactory(httpConfig));
            }
            String proto = (major > 9 || (major == 9 && minor >= 3)) ? "SSL" : "SSL-HTTP/1.1";
            result.setDefaultProtocol(proto);
        } else if (isHttp2Enabled(bus)) {
            connectionFactories.add(new HTTP2CServerConnectionFactory(httpConfig));
        }
        connectionFactories.add(httpFactory);
        result.setConnectionFactories(connectionFactories);
        if (getMaxIdleTime() > 0) {
            result.setIdleTimeout(Long.valueOf(getMaxIdleTime()));
        }
    } catch (RuntimeException rex) {
        throw rex;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
    return result;
}
Also used : HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) ALPNServerConnectionFactory(org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration) HTTP2ServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory) SslConnectionFactory(org.eclipse.jetty.server.SslConnectionFactory) ServletException(javax.servlet.ServletException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) SslConnectionFactory(org.eclipse.jetty.server.SslConnectionFactory) HTTP2CServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory) HttpConnectionFactory(org.eclipse.jetty.server.HttpConnectionFactory) ALPNServerConnectionFactory(org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory) HTTP2ServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory) ConnectionFactory(org.eclipse.jetty.server.ConnectionFactory) ServerConnector(org.eclipse.jetty.server.ServerConnector) HTTP2CServerConnectionFactory(org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory) AbstractConnector(org.eclipse.jetty.server.AbstractConnector)

Aggregations

HTTP2CServerConnectionFactory (org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory)13 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)13 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)12 ServerConnector (org.eclipse.jetty.server.ServerConnector)11 Server (org.eclipse.jetty.server.Server)6 SslConnectionFactory (org.eclipse.jetty.server.SslConnectionFactory)5 HTTP2ServerConnectionFactory (org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory)4 SecureRequestCustomizer (org.eclipse.jetty.server.SecureRequestCustomizer)4 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)4 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)4 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)4 ArrayList (java.util.ArrayList)3 ALPNServerConnectionFactory (org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory)3 ConnectionFactory (org.eclipse.jetty.server.ConnectionFactory)3 IOException (java.io.IOException)2 ServletException (javax.servlet.ServletException)2 HttpServlet (javax.servlet.http.HttpServlet)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 MBeanContainer (org.eclipse.jetty.jmx.MBeanContainer)2