#12231 closed enhancement (fixed)
Uniform access to HTTP resources
| Reported by: | simon04 | Owned by: | simon04 |
|---|---|---|---|
| Priority: | normal | Milestone: | 15.12 |
| Component: | Core | Version: | |
| Keywords: | http compression urlconnection | Cc: |
Description
(This is meant as a broader follow-up of #12220.)
Currently, we have various ways to access HTTP resources. Especially, currently we have 3 implementations to follow HTTP redirects, which do not cover all possible HTTP calls.
src/org/openstreetmap/josm/tools/Utils.java 943: connection = openHttpConnection(new URL(connection.getHeaderField("Location")), keepAlive); src/org/openstreetmap/josm/tools/HttpClient.java 85: final String redirectLocation = connection.getHeaderField("Location"); src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java 327: urlConn = getURLConnection(new URL(urlConn.getHeaderField("Location"))); 486: urlConn = getURLConnection(new URL(urlConn.getHeaderField("Location")));
Despite having some utility functions, many classes perform operations directly on HttpURLConnections.
Inspired by https://github.com/google/google-http-java-client and our very handy ImageProvider, I implemented a HttpClient class.
My final goal is to replace all Utils.openURL* and HttpURLConnection usages with this new class.
Attachments (1)
Change History (29)
by , 10 years ago
| Attachment: | 12231-alpha.patch added |
|---|
comment:1 by , 10 years ago
follow-up: 13 comment:9 by , 10 years ago
The DirectUpload plugin needs to be adapted in org.openstreetmap.josm.plugins.DirectUpload.UploadOsmConnection#addAuthHack – fixing a hack :( …
follow-up: 17 comment:13 by , 10 years ago
Replying to simon04:
The
DirectUploadplugin needs to be adapted inorg.openstreetmap.josm.plugins.DirectUpload.UploadOsmConnection#addAuthHack– fixing a hack :( …
I have made some changes in r9178:9179 + [o31871:31872] in order to fix the build but this is not finished yet, the plugin now lacks the ability of displaying upload progress as before. Can you please look into that?
comment:14 by , 10 years ago
Also, two unit tests are now failing:
MultiFetchServerObjectReaderTest
OsmServerBackreferenceReaderTest
For both of them we have:
WARNING: Already here java.net.SocketTimeoutException: Read timed out WARNING: Already here java.net.SocketTimeoutException: Read timed out WARNING: Already here java.net.SocketTimeoutException: Read timed out WARNING: Already here java.net.SocketTimeoutException: Read timed out WARNING: Already here java.net.SocketTimeoutException: Read timed out
comment:15 by , 10 years ago
| Cc: | removed |
|---|---|
| Summary: | [Patch draft] Uniform access to HTTP resources → Uniform access to HTTP resources |
comment:17 by , 10 years ago
Replying to Don-vip:
I have made some changes in r9178:9179 + [o31871:31872] in order to fix the build but this is not finished yet, the plugin now lacks the ability of displaying upload progress as before. Can you please look into that?
Wow, thank you for taking care of the plugin! So what we would need is basically the analogue of ProgressInputStream when sending data to connection.getOutputStream?
follow-up: 26 comment:24 by , 10 years ago
comment:26 by , 10 years ago
Replying to Don-vip:
is there a reason to not use
!reasonForRequest.isEmpty()?
No, I must have been confused while taking over this feature from https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/io/OsmServerReader.java?rev=9078#L153
comment:27 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |



Nice :) I think you can go ahead :)