Changeset 12596 in josm for trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
- Timestamp:
- 2017-08-13T00:24:03+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r12542 r12596 6 6 import java.io.IOException; 7 7 import java.io.InputStream; 8 import java.nio.charset.StandardCharsets; 8 9 import java.util.EnumMap; 9 10 import java.util.Map; … … 35 36 */ 36 37 public class OverpassDownloadReader extends BoundingBoxDownloader { 38 39 private static final String DATA_PREFIX = "?data="; 37 40 38 41 static final class OverpassOsmReader extends OsmReader { … … 144 147 final String query = this.overpassQuery.replace("{{bbox}}", lat1 + "," + lon1 + "," + lat2 + "," + lon2); 145 148 final String expandedOverpassQuery = expandExtendedQueries(query); 146 return "interpreter ?data="+ Utils.encodeUrl(expandedOverpassQuery);149 return "interpreter" + DATA_PREFIX + Utils.encodeUrl(expandedOverpassQuery); 147 150 } 148 151 } … … 195 198 boolean uncompressAccordingToContentDisposition) throws OsmTransferException { 196 199 try { 197 return super.getInputStreamRaw(urlStr, progressMonitor, reason, uncompressAccordingToContentDisposition); 200 int index = urlStr.indexOf(DATA_PREFIX); 201 // Make an HTTP POST request instead of a simple GET, allows more complex queries 202 return super.getInputStreamRaw(urlStr.substring(0, index), 203 progressMonitor, reason, uncompressAccordingToContentDisposition, 204 "POST", Utils.decodeUrl(urlStr.substring(index + DATA_PREFIX.length())).getBytes(StandardCharsets.UTF_8)); 198 205 } catch (OsmApiException ex) { 199 206 final String errorIndicator = "Error</strong>: ";
Note:
See TracChangeset
for help on using the changeset viewer.