You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by candrews <ca...@integralblue.com> on 2011/11/11 17:48:51 UTC

Re: Fully Android compatible HttpClient 4.1.x; was Re: HttpClient-Cache release that works against HttpClient 4.0?

That idea sounds awesome to me - I may even do it. How would you like such a
thing implemented? As a script? A diff against "regular" httpclient?

Interestingly, for the case of HttpClient-Cache, my original problem would
not be solved by this approach. HttpClient-Cache uses EntityUtils.consume
statically, and there's no way to fix that. Perhaps a simple change to not
use EntityUtils.consume and thus conform to the HttpClient 4.0 API would be
alright? Also, I confirmed with that change, HttpClient-Cache works in
Android (the jar, that is) and the compiled jar only uses HttpClient 4.0
APIs. The unit tests, however, use methods from beyond the 4.0 API and thus
do not run against HttpClient 4.0.


olegk wrote:
> 
> On Thu, Nov 10, 2011 at 11:49:09AM -0800, candrews wrote:
>> 
>> I thought of that, but it won't work when an Android app has dependencies
>> that use HttpClient.
>> 
>> I use Spring Android Rest Template. My goal is to use Rest Template with
>> caching via HttpClient-Cache. If I shade HttpClient (and
>> HttpClient-Cache),
>> and include the shaded jar in my project, then Rest Template will not use
>> it
>> (as it's compiled to use the "real" HttpClient, not my private copy in a
>> new
>> namespace). So now I have to process Rest Template using Maven Shade. I'd
>> also like osmdroid to use the same HttpClient, so I have to shade it
>> too...
>> Now I'm using at least 4 custom created jar's outside of my Android app's
>> ant build system, causing a serious maintenance problem :-)
>> 
>> Is there an ant analogue to Maven Shade? Is there a different approach to
>> solving these problems?
>> 
> 
> There is a way to build a reasonably up-to-date version of HttpClient
> fully compatible with Android: shade impl classes and new interfaces only
> and make them compileable against 4.0 API. That would involve a bit more
> work but result in a library fully compatible with Android and 3rd party
> libraries at the same time.
> 
> If someone were to contribute such a port to the project, we probably
> could even ship it as an official ASF release.
> 
> Oleg
> 
> 
> 
>> (I apologize if I'm hijacking this list inappropriately - IMHO this seems
>> relevant to httpclient-user, and I'm not sure where else to ask. I'll
>> happily shut up if the list maintainer believes this thread is
>> off-topic).
>> 
>> Thanks again!
>> ~Craig
>> 
>> 
>> sebb-2-2 wrote:
>> > 
>> > On 9 November 2011 04:05, candrews <ca...@integralblue.com> wrote:
>> >>
>> >> Maven Shade isn't compatible with maven-android-plugin:
>> >> https://code.google.com/p/maven-android-plugin/issues/detail?id=170
>> >> Perhaps
>> >> when that is resolved, Shade will be a solution for Maven users. But
>> what
>> >> about Ant users (which I think are what most of the Android apps are
>> >> built
>> >> with)?
>> > 
>> > It would also be possible to use the Maven Shade plugin to create a
>> > version of the HC jars with a different package name.
>> > This would be done independently of any Android build, whether using
>> > Maven or Ant.
>> > 
>> > You then build the Android stuff against the shaded jar, using the new
>> > package names.
>> > 
>> > This is not an ideal long-term solution, but should be sufficient for
>> > prototyping purposes.
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> > 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/HttpClient-Cache-release-that-works-against-HttpClient-4.0--tp32775131p32821369.html
>> Sent from the HttpClient-User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/HttpClient-Cache-release-that-works-against-HttpClient-4.0--tp32775131p32826896.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: Fully Android compatible HttpClient 4.1.x; was Re: HttpClient-Cache release that works against HttpClient 4.0?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2012-07-08 at 06:39 +0000, Mayur Rustagi wrote:
> Hi Guys,
> Any progress on this? This would work wonders with my application.
> Regards
> Mayur
> 


Not much progress, unfortunately. I have my hands full with the next
release of HttpAsyncClient and a major refactoring of HttpClient in the
4.3 branch. It might well happen that 4.3 release would technically be
the best opportunity for an Android port. Pretty much all high level
impl classes shipped with Android will be deprecated by then and
replaced with new implementations, making it much easier to provide
backward compatibility with previous releases.  

Anyway, help would be welcome.

Oleg


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


Re: Fully Android compatible HttpClient 4.1.x; was Re: HttpClient-Cache release that works against HttpClient 4.0?

Posted by Mayur Rustagi <ma...@scan2cart.com>.
Hi Guys,
Any progress on this? This would work wonders with my application.
Regards
Mayur


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


Re: Fully Android compatible HttpClient 4.1.x; was Re: HttpClient-Cache release that works against HttpClient 4.0?

Posted by Oleg Kalnichevski <ol...@apache.org>.
candrews <ca...@integralblue.com> wrote:

>
>That idea sounds awesome to me - I may even do it. How would you like
>such a
>thing implemented? As a script? A diff against "regular" httpclient?
>

Ideally a script that svn copies files off a release tag, say 4.1.2 and a diff containing adjustments. That would be the ideal case.


>Interestingly, for the case of HttpClient-Cache, my original problem
>would
>not be solved by this approach. HttpClient-Cache uses
>EntityUtils.consume
>statically, and there's no way to fix that. Perhaps a simple change to
>not
>use EntityUtils.consume and thus conform to the HttpClient 4.0 API
>would be
>alright? Also, I confirmed with that change, HttpClient-Cache works in
>Android (the jar, that is) and the compiled jar only uses HttpClient
>4.0
>APIs. The unit tests, however, use methods from beyond the 4.0 API and
>thus
>do not run against HttpClient 4.0.
>

There is absolutely nothing that prevents you from shading that class and making the cache module use that shaded class instead of the old one. Only public interfaces and public classes referenced by those interfaces cannot be shaded.

Oleg


>
>olegk wrote:
>> 
>> On Thu, Nov 10, 2011 at 11:49:09AM -0800, candrews wrote:
>>> 
>>> I thought of that, but it won't work when an Android app has
>dependencies
>>> that use HttpClient.
>>> 
>>> I use Spring Android Rest Template. My goal is to use Rest Template
>with
>>> caching via HttpClient-Cache. If I shade HttpClient (and
>>> HttpClient-Cache),
>>> and include the shaded jar in my project, then Rest Template will
>not use
>>> it
>>> (as it's compiled to use the "real" HttpClient, not my private copy
>in a
>>> new
>>> namespace). So now I have to process Rest Template using Maven
>Shade. I'd
>>> also like osmdroid to use the same HttpClient, so I have to shade it
>>> too...
>>> Now I'm using at least 4 custom created jar's outside of my Android
>app's
>>> ant build system, causing a serious maintenance problem :-)
>>> 
>>> Is there an ant analogue to Maven Shade? Is there a different
>approach to
>>> solving these problems?
>>> 
>> 
>> There is a way to build a reasonably up-to-date version of HttpClient
>> fully compatible with Android: shade impl classes and new interfaces
>only
>> and make them compileable against 4.0 API. That would involve a bit
>more
>> work but result in a library fully compatible with Android and 3rd
>party
>> libraries at the same time.
>> 
>> If someone were to contribute such a port to the project, we probably
>> could even ship it as an official ASF release.
>> 
>> Oleg
>> 
>> 
>> 
>>> (I apologize if I'm hijacking this list inappropriately - IMHO this
>seems
>>> relevant to httpclient-user, and I'm not sure where else to ask.
>I'll
>>> happily shut up if the list maintainer believes this thread is
>>> off-topic).
>>> 
>>> Thanks again!
>>> ~Craig
>>> 
>>> 
>>> sebb-2-2 wrote:
>>> > 
>>> > On 9 November 2011 04:05, candrews <ca...@integralblue.com>
>wrote:
>>> >>
>>> >> Maven Shade isn't compatible with maven-android-plugin:
>>> >>
>https://code.google.com/p/maven-android-plugin/issues/detail?id=170
>>> >> Perhaps
>>> >> when that is resolved, Shade will be a solution for Maven users.
>But
>>> what
>>> >> about Ant users (which I think are what most of the Android apps
>are
>>> >> built
>>> >> with)?
>>> > 
>>> > It would also be possible to use the Maven Shade plugin to create
>a
>>> > version of the HC jars with a different package name.
>>> > This would be done independently of any Android build, whether
>using
>>> > Maven or Ant.
>>> > 
>>> > You then build the Android stuff against the shaded jar, using the
>new
>>> > package names.
>>> > 
>>> > This is not an ideal long-term solution, but should be sufficient
>for
>>> > prototyping purposes.
>>> > 
>>> >
>---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>> > For additional commands, e-mail:
>httpclient-users-help@hc.apache.org
>>> > 
>>> > 
>>> > 
>>> 
>>> -- 
>>> View this message in context:
>>>
>http://old.nabble.com/HttpClient-Cache-release-that-works-against-HttpClient-4.0--tp32775131p32821369.html
>>> Sent from the HttpClient-User mailing list archive at Nabble.com.
>>> 
>>> 
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> 
>> 
>> 
>
>-- 
>View this message in context:
>http://old.nabble.com/HttpClient-Cache-release-that-works-against-HttpClient-4.0--tp32775131p32826896.html
>Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>For additional commands, e-mail: httpclient-users-help@hc.apache.org



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