hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mats Eklund <mats.ekl...@live.at>
Subject Re: How replace the default HTTP URL handler in Java with one that uses the Apache HTTPClient?
Date Fri, 19 May 2017 13:27:21 GMT

Hi Oleg,

Thanks for your reply.

So I guess I'd need to roll my own.

Not sure what you mean regarding the URLConnection API. The libraries in my project retrieve
web resources by instantiating a java.net.URL object, and then calling one or two methods
for retrieving the dereferenced resource on an input stream. It doesn't sound like it would
be too complex, but maybe there is something in the details...?


On Thu, 2017-05-18 at 09:49 +0000, Mats Eklund wrote:
> Hi,
> I am thinking of replacing the default HTTP connection handler in my
> Java web applications with one that uses Apache HTTPClient. The
> reason is that I want to leverage response caching of outbound HTTP
> requests made from my web application. The requests are made via
> various libraries, all using the standard java.net.URL class to
> access resources on the web.
> Does the HTTP Components framework contain a ready to use solution
> for this, or are there some guidelines available for how to best go
> about it. I guess what I am looking for could be a common scenario! I
> found some possible directions here:
> http://mjremijan.blogspot.co.at/2012/02/create-your-own-java-url-hand

> lers.html
> http://stackoverflow.com/questions/27993995/creating-httpurlconnectio

> n-for-urlstreamhandlerfactory-getting-error-
> protocol/28101085#28101085
> But maybe there is already a ready to use component available, that
> could be simply dropped along with a configuration file for the
> caching behavior into the application's libraries folder?
> Thanks so much in advance for any advice!
> Mats

A long time ago (more than 10 years back) there was an effort to
provide a HttpUrlConnection compatibility facade but it was eventually
abandoned as pointless. HttpUrlConnection APIs are so bad that is no
point supporting them. We might at some point look at providing a
compatibility layer for the coming HTTP client APIs in Java 1.9.


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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message