Changeset 13036 in osm
- Timestamp:
- 2009-01-08T09:40:26+01:00 (16 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
r11783 r13036 252 252 url = new URL(tile.getUrl()); 253 253 HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); 254 prepareHttpUrlConnection(urlConn); 254 255 urlConn.setRequestMethod("HEAD"); 255 256 urlConn.setReadTimeout(30000); // 30 seconds read timeout … … 267 268 url = new URL(tile.getUrl()); 268 269 HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); 270 prepareHttpUrlConnection(urlConn); 269 271 urlConn.setRequestMethod("HEAD"); 270 272 urlConn.setReadTimeout(30000); // 30 seconds read timeout -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
r11783 r13036 19 19 */ 20 20 public class OsmTileLoader implements TileLoader { 21 22 /** 23 * Holds the used user agent used for HTTP requests. If this field is 24 * <code>null</code>, the default Java user agent is used. 25 */ 26 public static String USER_AGENT = null; 27 public static String ACCEPT = "text/html, image/png, image/jpeg, image/gif, */*"; 21 28 22 29 protected TileLoaderListener listener; … … 66 73 url = new URL(tile.getUrl()); 67 74 HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); 68 urlConn.setReadTimeout(30000); // 30 seconds read69 //timeout75 prepareHttpUrlConnection(urlConn); 76 urlConn.setReadTimeout(30000); // 30 seconds read timeout 70 77 return urlConn; 78 } 79 80 protected void prepareHttpUrlConnection(HttpURLConnection urlConn) { 81 if (USER_AGENT != null) 82 urlConn.setRequestProperty("User-agent", USER_AGENT); 83 urlConn.setRequestProperty("Accept", ACCEPT); 71 84 } 72 85
Note:
See TracChangeset
for help on using the changeset viewer.