On Sat, Feb 24, 2018 at 8:45 AM, Gary Gregory <garydgreg...@gmail.com>
wrote:

>
>
> On Sat, Feb 24, 2018 at 3:52 AM, Oleg Kalnichevski <ol...@apache.org>
> wrote:
>
>> On Fri, 2018-02-23 at 21:13 -0700, Gary Gregory wrote:
>> > Hi All,
>> >
>> > In my proxy, I use:
>> >
>> > DefaultHttpServerIODispatch.create(serviceHandler, serverSslContext,
>> > serverConnectionConfig)
>> >
>> > In order to support HTTP DELETE with a message body (I know, I know),
>> > I've
>> > created a custom HttpRequestFactory implementation.
>> >
>> > So I want this to kick in so that by the time my
>> > custom
>> > org.apache.http.nio.protocol.HttpAsyncRequestProducer.generateRequest
>> > ()
>> >  called, the request is the BasicHttpEntityEnclosingRequest I created
>> > in my
>> > HttpRequestFactory.
>> >
>> > A HttpRequestFactory lives in a
>> > NHttpMessageParserFactory<HttpRequest>.
>> >
>> > Would it be acceptable to add support for HttpRequestFactory and/or
>> > NHttpMessageParserFactory to ConnectionConfig?
>> >
>> > Gary
>>
>> Why would you want to add an HTTP protocol level interface to a class
>> that represents transport parameters?  Would there be any benefits of
>> mixing completely unrelated things?
>>
>
> From a simple point of view -- even though there is nothing simple about
> my proxy -- I have a factory method with one parameter being a "config"
> object, so I am thinking "Hey, this looks like a nice place to hang this
> object which can be picked up when this whole tree of objects gets
> constructed."
>
> I will study the code some more...
>

My code now uses this method:

    private DefaultHttpServerIODispatch<ProxyServiceHandler>
createHttpServerIODispatch(final SSLContext sslContext, final
ConnectionConfig serverConnectionConfig) {
        NHttpMessageParserFactory<HttpRequest> httpRequestParserFactory =
new DefaultHttpRequestParserFactory(null,
CompleteHttpRequestFactory.INSTANCE);
        // @formatter:off
        return sslContext == null
                ? new DefaultHttpServerIODispatch<>(serviceHandler,
                        new DefaultNHttpServerConnectionFactory(null,
httpRequestParserFactory, null, serverConnectionConfig))
                : new DefaultHttpServerIODispatch<>(serviceHandler,
                        new SSLNHttpServerConnectionFactory(sslContext,
null, httpRequestParserFactory, null, serverConnectionConfig));
        // @formatter:om
    }

where  CompleteHttpRequestFactory is a custom class.

This is done instead of calling
DefaultHttpServerIODispatch.create(serviceHandler,
serverSslContext, serverConnectionConfig)

Can you see augmenting HC to make this less convoluted?

Gary



>
> Gary
>
>
>>
>> Oleg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
>> For additional commands, e-mail: dev-h...@hc.apache.org
>>
>>
>

Reply via email to