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: workaround for java.net.URI fails for RFC 3986
Date Sat, 14 Jan 2012 12:05:03 GMT
On Sat, 2012-01-14 at 00:53 -0800, becks007 wrote:
> Thanks Oleg!
> 
> The key issue is that java.net.URI is not allowing to create object without
> encoding the URL.
> org.apache.http.impl.client.RequestWrapper.getRequestLine() use
> java.net.URI.toASCIIString() though I override the
> org.apache.http.HttpRequest.getRequestLine() by creating a custom method
> implementation like HttpPost/HttpGet still primary control is with
> RequestWrapper.
> 

If a request URI can be expressed in RFC 2396 format without losing its
semantic meaning, one can reformat it to conform to the RFC 3986 format
while writing request out to the underlying connection using a custom
request writer

http://hc.apache.org/httpcomponents-core-ga/httpcore/xref/org/apache/http/impl/io/HttpRequestWriter.html#52

> Now regarding first option of switching to HttpCore I couldn't clearly
> understand what are the key differences or possibly what could be impact in
> using HttpCore now. If there are good enough reasons to write a message
> writter as you suggested will go with that. I had a look at the code and I
> couldn't get the message writer overriding class which you are mentioning.  
> 
> Also I need to use connection management and multi-threaded connection pool
> so I believe this will have to stick with httpcomponents.
> 

HttpCore is a set of HTTP transport components HttpClient is based upon.
Effectively HttpClient = HttpCore + support for HTTP via proxy / auth /
state management (cookies). As long as you do not mind sacrificing these
higher level functions HttpCore might be a reasonable choice for you. 

Another alternative is writing your own RequestDirector

http://hc.apache.org/httpcomponents-client-ga/httpclient/xref/org/apache/http/impl/client/DefaultRequestDirector.html

Please note, though, DefaultRequestDirector is the single most complex
class in HttpClient.

Oleg



---------------------------------------------------------------------
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