- Timestamp:
- 2007-05-07T23:26:58+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/io/OsmServerReader.java
r225 r228 5 5 import java.net.HttpURLConnection; 6 6 import java.net.URL; 7 import java.util.zip.Inflater; 8 import java.util.zip.InflaterInputStream; 9 import java.util.zip.GZIPInputStream; 7 10 8 11 import org.openstreetmap.josm.Main; … … 10 13 11 14 /** 12 * This DataReader read directly from the REST API of the osm server. 15 * This DataReader reads directly from the REST API of the osm server. 16 * 17 * It supports plain text transfer as well as gzip or deflate encoded transfers; 18 * if compressed transfers are unwanted, set property osm-server.use-compression 19 * to false. 13 20 * 14 21 * @author imi … … 32 39 return null; 33 40 } 41 42 if (Boolean.parseBoolean(Main.pref.get("osm-server.use-compression", "true"))) 43 activeConnection.setRequestProperty("Accept-Encoding", "gzip, deflate"); 44 34 45 System.out.println("got return: "+activeConnection.getResponseCode()); 35 46 activeConnection.setConnectTimeout(15000); 36 47 if (isAuthCancelled() && activeConnection.getResponseCode() == 401) 37 48 return null; 38 return new ProgressInputStream(activeConnection, pleaseWaitDlg); 49 50 String encoding = activeConnection.getContentEncoding(); 51 InputStream inputStream = new ProgressInputStream(activeConnection, pleaseWaitDlg); 52 if (encoding != null && encoding.equalsIgnoreCase("gzip")) { 53 inputStream = new GZIPInputStream(inputStream); 54 } 55 else if (encoding != null && encoding.equalsIgnoreCase("deflate")) { 56 inputStream = new InflaterInputStream(inputStream, new Inflater(true)); 57 } 58 return inputStream; 39 59 } 40 60 }
Note:
See TracChangeset
for help on using the changeset viewer.