On Mon, Feb 26, 2018 at 4:12 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Sun, 2018-02-25 at 13:36 -0700, Gary Gregory wrote: > > On Sat, Feb 24, 2018 at 8:45 AM, Gary Gregory <garydgreg...@gmail.com > > > > > > ... > > > > 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 > > > > Hi Gary > > You have already added a number of convenience #create methods. Why do > not you add a static #create method that takes HttpRequestFactory as a > parameter? > Sure, I can do that. I am not crazy about repeating the pattern "sslContext == null ? ... : ..." like we have in the static method I initially used; which is why I wanted to push down the parser factory into ConnectionConfig. But I do see your point: a HttpRequestFactory and HttpRequestParserFactory are not part of configuring a connection. Gary > Oleg > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org > For additional commands, e-mail: dev-h...@hc.apache.org > >