hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Mapping javax.servlet to HttpCore - best practices questions
Date Wed, 04 Feb 2009 23:21:32 GMT
Todd W Lainhart wrote:
> I'm working on a prototype where I hide the HttpServletRequest/Response 
> objects and the various servlet goo-age behind HttpRequest/Response. 
> Imagine that a servlet is calling out to a handler of a "service(...)" 
> where the parameters are HttpRequest/Response, populated by the servlet 
> prior to calling this handler.  I'm looking for best practices to do this, 
> based on the design of the HttpCore classes and the expectations of 
> clients that receive HttpRequest/Response objects.  I've done 
> "TheGuidedTour..." and read some Javadoc.
> 

Todd,

The guided tour is somewhat outdated. There is a more recent and more 
complete document describing HttpCore API and its intended usage:

http://hc.apache.org/httpcomponents-core/tutorial/html/
http://hc.apache.org/httpcomponents-core/tutorial/pdf/httpcore-tutorial.pdf

I'll look into your questions tomorrow in details and try to give you 
some recommendations. However, I just cannot help wondering what it the 
reason for trying to put HttpCore on top of a Servlet based transport?

While HTTP headers may be relatively easy to map, content streaming may 
be significantly more difficult to achieve without a certain performance 
degradation.

Oleg

> HttpServletRequest headers: These seem straightforward enough - I just 
> copy these into the headers of the HttpServletRequest.
> 
> HttpServletRequest parameters: Based on my reading of "GuidedTour..." I'm 
> guessing that stuff this parameter map into some HttpParams derivation 
> associated to the HttpRequest, and document the well-known key?
> 
> HttpServletRequest other data : Likewise, I stuff this data into 
> HttpParams (either Basic or a specialized derivation)?
> 
> ServletRequest host info : I grab this data, put it into an HttpHost 
> object, and associate it to the HttpRequest's HttpContext?
> 
> In dealing with the HttpResponse when shipping this data back out through 
> the HttpServletResponse, I think I'm going to want to run the responses 
> interceptors as well as checking headers.  If both a header and an 
> interceptor for that header is defined, it looks like I should err-out, 
> rather than prefer one over the other?
> 
>   -- Todd
> 


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


Mime
View raw message