You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by William Speirs <ws...@apache.org> on 2012/08/03 22:31:46 UTC

Resolving an HttpAsyncRequestHandler from an HttpRequest

The HttpAsyncRequestHandlerResolver interface only allows for
resolving an HttpAsyncRequestHandler via URI, and
HttpAsyncService.getRequestHandler() is marked as private, so
extending that class to change functionality it's possible. What would
be the easiest way to change HttpCore-NIO to resolve an
HttpAsyncRequestHandler from an HttpRequest?

I am looking to resolve based upon the Host header... essentially,
providing virtual host support to HttpCore-NIO.

Thoughts?

Thanks!

Bill-

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


Re: Resolving an HttpAsyncRequestHandler from an HttpRequest

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2012-08-06 at 14:56 -0400, Bill Speirs wrote:
> What we'd truly like to do is resolve a request based upon host first,
> then based upon URI. Certainly rolling-out a handler for /*, then
> having that handler call the other handlers based upon host/URI would
> work, but it feels ugly.
> 
> Do you want me to open a JIRA ticket with patch to make
> HttpAsyncService.getRequestHandler() protected?
> 
> I'd be willing to put some work into making these interfaces more
> generic, should I open a JIRA for that discussion, or keep it here?
> 

I think you should raise a JIRA for this change and put a short summary
of what has been discussed on the dev list there.

> Such changes would have to be released with 5.0 as they would probably
> be API breaking, correct. I realize we're only on 4.2.X for core, but
> is it worth starting a 5.0 branch for these types of things? We could
> also probably delete a lot of deprecated code.
> 

There is no need to wait till 5.0. We can deprecate the old interfaces,
add new ones and provide compatibility adaptors for the deprecated API.
This should keep HttpCore 4.3 fully compatible with the older versions
and allow for a gradual migration path. There are plenty of examples of
this approach in core and client. See this adaptor class [1] that
provides compatibility mappings between newer RedirectStrategy and
deprecated RedirectHandler APIs.

> Let me know and I could probably start on that effort if you think
> it's worth it now.
> 

Absolutely!

Oleg

[1]
http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRedirectStrategyAdaptor.java


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


Re: Resolving an HttpAsyncRequestHandler from an HttpRequest

Posted by Bill Speirs <bi...@gmail.com>.
What we'd truly like to do is resolve a request based upon host first,
then based upon URI. Certainly rolling-out a handler for /*, then
having that handler call the other handlers based upon host/URI would
work, but it feels ugly.

Do you want me to open a JIRA ticket with patch to make
HttpAsyncService.getRequestHandler() protected?

I'd be willing to put some work into making these interfaces more
generic, should I open a JIRA for that discussion, or keep it here?

Such changes would have to be released with 5.0 as they would probably
be API breaking, correct. I realize we're only on 4.2.X for core, but
is it worth starting a 5.0 branch for these types of things? We could
also probably delete a lot of deprecated code.

Let me know and I could probably start on that effort if you think
it's worth it now.

Thanks!

Bill-

On Fri, Aug 3, 2012 at 5:56 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Fri, 2012-08-03 at 16:31 -0400, William Speirs wrote:
>> The HttpAsyncRequestHandlerResolver interface only allows for
>> resolving an HttpAsyncRequestHandler via URI, and
>> HttpAsyncService.getRequestHandler() is marked as private, so
>> extending that class to change functionality it's possible. What would
>> be the easiest way to change HttpCore-NIO to resolve an
>> HttpAsyncRequestHandler from an HttpRequest?
>>
>> I am looking to resolve based upon the Host header... essentially,
>> providing virtual host support to HttpCore-NIO.
>>
>> Thoughts?
>>
>> Thanks!
>>
>> Bill-
>>
>
> Hi Bill
>
> Making HttpAsyncService#getRequestHandler() protected would probably be
> the easiest. However, we could consider deprecating
> HttpRequestHandlerResolver and HttpAsyncRequestHandlerResolver in favor
> of more generic interfaces.
>
> Please note that as an interim solution you can always make
> HttpAsyncRequestHandlerResolver resolve the request URI to a
> HttpAsyncRequestHandler that delegates request processing to custom
> handlers based on some other properties of the request.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>

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


Re: Resolving an HttpAsyncRequestHandler from an HttpRequest

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2012-08-03 at 16:31 -0400, William Speirs wrote:
> The HttpAsyncRequestHandlerResolver interface only allows for
> resolving an HttpAsyncRequestHandler via URI, and
> HttpAsyncService.getRequestHandler() is marked as private, so
> extending that class to change functionality it's possible. What would
> be the easiest way to change HttpCore-NIO to resolve an
> HttpAsyncRequestHandler from an HttpRequest?
> 
> I am looking to resolve based upon the Host header... essentially,
> providing virtual host support to HttpCore-NIO.
> 
> Thoughts?
> 
> Thanks!
> 
> Bill-
> 

Hi Bill

Making HttpAsyncService#getRequestHandler() protected would probably be
the easiest. However, we could consider deprecating
HttpRequestHandlerResolver and HttpAsyncRequestHandlerResolver in favor
of more generic interfaces.

Please note that as an interim solution you can always make
HttpAsyncRequestHandlerResolver resolve the request URI to a
HttpAsyncRequestHandler that delegates request processing to custom
handlers based on some other properties of the request. 

Oleg



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