You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2018/02/27 02:19:00 UTC

[jira] [Created] (HTTPCORE-515) Add convenience API org.apache.http.impl.nio.DefaultHttpServerIODispatch.create(T, SSLContext, ConnectionConfig, HttpRequestFactory)

Gary Gregory created HTTPCORE-515:
-------------------------------------

             Summary: Add convenience API org.apache.http.impl.nio.DefaultHttpServerIODispatch.create(T, SSLContext, ConnectionConfig, HttpRequestFactory)
                 Key: HTTPCORE-515
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-515
             Project: HttpComponents HttpCore
          Issue Type: Improvement
          Components: HttpCore NIO
            Reporter: Gary Gregory
            Assignee: Gary Gregory
             Fix For: 4.4.10


Add convenience API {{org.apache.http.impl.nio.DefaultHttpServerIODispatch.create(T, SSLContext, ConnectionConfig, HttpRequestFactory)}}:

{code:java}
     /**
     * Creates a new instance of this class to be used for dispatching I/O event
     * notifications to the given protocol handler.
     * 
     * @param eventHandler the server protocol handler.
     * @param sslContext an SSLContext or null (for a plain text connection.)
     * @param config a connection configuration
     * @param httpRequestFactory the request factory used by this object to generate {@link HttpRequest} instances. 
     * @return a new instance
     * @since 4.4.10
     */
    public static <T extends NHttpServerEventHandler> DefaultHttpServerIODispatch<T> create(final T eventHandler,
            final SSLContext sslContext, final ConnectionConfig config, HttpRequestFactory httpRequestFactory) {
        final NHttpMessageParserFactory<HttpRequest> httpRequestParserFactory = new DefaultHttpRequestParserFactory(
                null, httpRequestFactory);
        // @formatter:off
        return sslContext == null
                ? new DefaultHttpServerIODispatch<T>(eventHandler,
                        new DefaultNHttpServerConnectionFactory(null, httpRequestParserFactory, null, config))
                : new DefaultHttpServerIODispatch<T>(eventHandler,
                        new SSLNHttpServerConnectionFactory(sslContext, null, httpRequestParserFactory, null, config));
        // @formatter:om
    }
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org