Java 类org.eclipse.jetty.server.AbstractConnectionFactory 实例源码

项目:feathercon    文件:FeatherCon.java   
private Integer getPort(Scheme scheme) {
    for (Connector connector : server.getConnectors()) {
        if (connector instanceof ServerConnector) {
            ServerConnector serverConnector = (ServerConnector) connector;
            Collection<ConnectionFactory> connectionFactories = serverConnector.getConnectionFactories();
            for (ConnectionFactory connectionFactory : connectionFactories) {
                Class<? extends AbstractConnectionFactory> connectorClass;
                switch (scheme) {
                    case HTTP:
                        connectorClass = HttpConnectionFactory.class;
                        break;
                    case HTTPS:
                        connectorClass = SslConnectionFactory.class;
                        break;
                    default:
                        throw new UnsupportedOperationException("No such scheme.");
                }
                if (connectorClass.isAssignableFrom(connectionFactory.getClass())) {
                    return serverConnector.getLocalPort();
                }
            }
        }
    }
    return null;
}
项目:calcite-avatica    文件:HttpServer.java   
private ServerConnector getConnector() {
  HttpConnectionFactory factory = new HttpConnectionFactory();
  factory.getHttpConfiguration().setRequestHeaderSize(maxAllowedHeaderSize);

  if (null == sslFactory) {
    return new ServerConnector(server, factory);
  }
  return new ServerConnector(server, AbstractConnectionFactory.getFactories(sslFactory, factory));
}
项目:restlet-jetty9    文件:JettyHttpsServerHelper.java   
/**
 * Creates new internal Jetty connection factories.
 * 
 * @param configuration
 *        The HTTP configuration.
 * @return New internal Jetty connection factories.
 */
protected ConnectionFactory[] createConnectionFactories( HttpConfiguration configuration )
{
    ConnectionFactory[] connectionFactories = super.createConnectionFactories( configuration );

    try
    {
        final org.restlet.engine.ssl.SslContextFactory sslContextFactory = SslUtils.getSslContextFactory( this );
        final SslContextFactory jettySslContextFactory = new SslContextFactory();
        jettySslContextFactory.setSslContext( sslContextFactory.createSslContext() );

        boolean h2 = false;
        for( Protocol protocol : getHelped().getProtocols() )
        {
            if( protocol.getName().equals( Http2.HTTPS_PROTOCOL.getName() ) && protocol.getVersion().equals( Http2.HTTPS_PROTOCOL.getVersion() ) )
            {
                h2 = true;
                break;
            }
        }

        if( h2 )
            // Make sure not to use bad cipher suites with HTTP/2
            jettySslContextFactory.setExcludeCipherSuites( Http2.TLS_BAD_CIPHER_SUITES );

        return AbstractConnectionFactory.getFactories( jettySslContextFactory, connectionFactories );
    }
    catch( Exception e )
    {
        getLogger().log( Level.WARNING, "Unable to create the Jetty SSL context factory", e );
        return null;
    }
}