Skip to content

Apache HTTP Client Removal #498

Closed
Closed

Description

@devemux86

Android 6.0 SDK (API 23) was released and removes some deprecated classes / methods.

In our case it's about the removal of Apache HTTP Client used in AndroidDownloader.
http://developer.android.com/preview/behavior-changes.html#behavior-apache-http-client

The recommended way is use of HttpURLConnection as seen in Downloader.

Activity

  1. added this to the 0.6 milestone on Aug 22, 2015
  2. karussell commented on Oct 11, 2015

    @karussell
    Member

    The problem is how can we remove it when it causes several issues without it like #251? Should we use something like OkHttp instead for Android? To my knowledge it is based on HttpURLConnection but corrects some limitations regarding certs etc.

  3. devemux86 commented on Oct 12, 2015

    @devemux86
    ContributorAuthor

    The best way would be handling the situation with the recommended Android way (there must be a solution somehow - though I have not managed investing time in it).

    We can continue with Apache HTTP APIs by declaring the folowing:

    android {
        useLibrary 'org.apache.http.legacy'
    }
  4. karussell commented on Oct 12, 2015

    @karussell
    Member

    As it is only a demo I would prefer a way which won't make problems in a year. So I would prefer to not go the legacy route and use either the Android way or the external okhttp, where I made good experiences with in our Java/Android clients

  5. devemux86 commented on Oct 12, 2015

    @devemux86
    ContributorAuthor

    Usually avoiding to load a library/app with too many external dependencies, so I'd first review the official recommendation.
    But it's your call at the end. 😄

  6. karussell commented on Oct 12, 2015

    @karussell
    Member

    Well, I do not care that much, as this is a demo and people can choose a different download mechanism. But yes, if there would be a stable and reusable download component without deps this would be best :) ... and we could keep the downloader pluggable.

    Also if people use http to download there should not be any problems

  7. devemux86 commented on Oct 12, 2015

    @devemux86
    ContributorAuthor

    Also if people use http to download there should not be any problems

    So why the https in Sample if it can solve the situation?

  8. karussell commented on Oct 12, 2015

    @karussell
    Member

    https is enforced for everything on GraphHopper.com

    I could make an exception for the maps, but it could make problems with the enabled hsts. Not sure if this applied only to browsers (I don't think so), so if the downloaded fetches once a https site it will never fetch a http site again.

  9. devemux86 commented on Oct 12, 2015

    @devemux86
    ContributorAuthor

    Well (not making promises) I can review the https issue, if another solution doesn't appear in the meantime.

  10. karussell commented on Oct 12, 2015

    @karussell
    Member

    I think it has something to do with the certificates or with some ssl ciphers that I did not allow for graphhopper.com and make only problems for older clients. So one would have to add these certs and/or make certain ciphers working BUT this is the work that okhttp already did if I'm not wrong and it is only 300KB ;)

  11. devemux86 commented on Oct 12, 2015

    @devemux86
    ContributorAuthor

    Ok since as you said it's about Samples only, we can go with an external dependency.

  12. karussell commented on Nov 19, 2015

    @karussell
    Member

    I'm puzzled. I'ved tried via http (and a subdomain, see #565) but it is only working with the modified AndroidDownloader...

  13. devemux86 commented on Nov 20, 2015

    @devemux86
    ContributorAuthor

    Really? I thought now with http we could use Downloader again..

  14. karussell commented on Nov 20, 2015

    @karussell
    Member

    I'm now very confused. We use setDoOutput in the Downloader which is wrong:
    "setDoOutput(true) is used for POST and PUT requests. If it is false then it is for using GET requests."

    So it is identical to #127 and it looks from history like we swapped forth and back for those setDoOutput/setDoInput method, see comment and then commit1, commit2 and commit3.

    So all hassle is probably because of that already fixed (and then accidentally reverted) bug which somehow only appeared for Android.

  15. karussell commented on Nov 20, 2015

    @karussell
    Member

    Please see if this fixes the problem for your Android version too :)

  16. devemux86 commented on Nov 20, 2015

    @devemux86
    ContributorAuthor

    I intend to PR some updates and will look after this too. 😄

  17. devemux86 commented on Nov 24, 2015

    @devemux86
    ContributorAuthor

    @karussell I tried the latest changes, it seems to download fine.

  18. devemux86 commented on Nov 24, 2015

    @devemux86
    ContributorAuthor

    I don't remember if we have discussed the possibility of Android DownloadManager system service.

  19. karussell commented on Nov 24, 2015

    @karussell
    Member

    Nice, thanks for the feedback! And please go ahead if there is something better/simpler than our current solution for Android :) !

  20. devemux86 commented on Nov 24, 2015

    @devemux86
    ContributorAuthor

    We use it in Mapsforge Samples in its simplest form, so it's worth a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions