HttpClient 3.1 to 4.0 migration: Encoding via URIUtil

View: New views
2 Messages — Rating Filter:   Alert me  

HttpClient 3.1 to 4.0 migration: Encoding via URIUtil

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys,

I'm migrating some code from HttpClient 3.1 to HttpClient 4.0. We were using
URIUtil in a couple of places (encodeQuery(), encodePath(), decode(), etc),
but I don't see any equivalent functionality in HC4. Does it exist? If not,
what was the reason for its removal, and is there some other library I
should be looking at instead? The closest thing I can find is Commons
Codec's URLCodec class, but (a) it behaves like java.net.URLEncoder
(replaces spaces with '+' chars instead of %20's), and (b) doesn't know
about differences in the allowed characters for the different parts of URLs.

Take care,

Daniel

--
Daniel Gredler
http://daniel.gredler.net/

Re: HttpClient 3.1 to 4.0 migration: Encoding via URIUtil

by olegk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Daniel Gredler wrote:
> Hi guys,
>
> I'm migrating some code from HttpClient 3.1 to HttpClient 4.0. We were using
> URIUtil in a couple of places (encodeQuery(), encodePath(), decode(), etc),
> but I don't see any equivalent functionality in HC4. Does it exist? If not,
> what was the reason for its removal, and is there some other library I
> should be looking at instead?

Daniel

The reason URI and URIUtils got replaced with the standard Java URI was
very simple: there was no one willing to maintain those classes.

There is a number of utility methods that help work around various
issues with the java.net.URI implementation but otherwise the standard
JRE classes should be sufficient, should not they?

http://hc.apache.org/httpcomponents-client/httpclient/apidocs/org/apache/http/client/utils/URIUtils.html

Oleg

  The closest thing I can find is Commons
> Codec's URLCodec class, but (a) it behaves like java.net.URLEncoder
> (replaces spaces with '+' chars instead of %20's), and (b) doesn't know
> about differences in the allowed characters for the different parts of URLs.
>



> Take care,
>
> Daniel
>


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