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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to