Changeset 9308 in josm
- Timestamp:
- 2016-01-04T20:09:51+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r9185 r9308 124 124 final HttpClient client = HttpClient.create(url); 125 125 client.setReasonForRequest(reason); 126 adaptRequest(client); 126 127 if (doAuthenticate) { 127 128 addAuth(client); … … 170 171 171 172 /** 173 * Allows subclasses to modify the request. 174 * @param request the prepared request 175 * @since 9308 176 */ 177 protected void adaptRequest(HttpClient request) { 178 } 179 180 /** 172 181 * Download OSM files from somewhere 173 182 * @param progressMonitor The progress monitor -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r8870 r9308 5 5 6 6 import java.io.InputStream; 7 import java.util.regex.Matcher; 8 import java.util.regex.Pattern; 7 9 8 10 import javax.xml.stream.XMLStreamConstants; … … 13 15 import org.openstreetmap.josm.data.osm.DataSet; 14 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 17 import org.openstreetmap.josm.tools.HttpClient; 15 18 import org.openstreetmap.josm.tools.Utils; 16 19 … … 105 108 106 109 @Override 110 protected void adaptRequest(HttpClient request) { 111 // see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#timeout 112 final Matcher timeoutMatcher = Pattern.compile("\\[timeout:(\\d+)\\]").matcher(overpassQuery); 113 if (timeoutMatcher.find()) { 114 final int timeout = 1000 * Integer.parseInt(timeoutMatcher.group(1)); 115 request.setConnectTimeout(timeout); 116 request.setReadTimeout(timeout); 117 } 118 } 119 120 @Override 107 121 protected String getTaskName() { 108 122 return tr("Contacting Server...");
Note:
See TracChangeset
for help on using the changeset viewer.