Changeset 33514 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
- Timestamp:
- 2017-08-23T00:34:13+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
r32556 r33514 7 7 import java.io.BufferedReader; 8 8 import java.io.IOException; 9 import java.io.InputStream; 9 10 import java.io.InputStreamReader; 10 11 import java.io.OutputStream; … … 29 30 import org.openstreetmap.josm.data.validation.util.Entities; 30 31 import org.openstreetmap.josm.gui.layer.Layer; 32 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 33 import org.openstreetmap.josm.gui.util.GuiHelper; 34 import org.openstreetmap.josm.io.OsmTransferException; 35 import org.openstreetmap.josm.io.ProgressInputStream; 31 36 import org.openstreetmap.josm.tools.GBC; 32 37 33 38 public class CadastreInterface { 34 39 public boolean downloadCanceled; 35 p ublicHttpURLConnection urlConn;40 private HttpURLConnection urlConn; 36 41 37 42 private String cookie; … … 53 58 private long cookieTimestamp; 54 59 55 static final String BASE_URL = "http ://www.cadastre.gouv.fr";60 static final String BASE_URL = "https://www.cadastre.gouv.fr"; 56 61 static final String C_IMAGE_FORMAT = "Cette commune est au format "; 57 62 static final String C_COMMUNE_LIST_START = "<select name=\"codeCommune\""; … … 98 103 } catch (IOException e) { 99 104 Main.error(e); 100 JOptionPane.showMessageDialog(Main.parent, 105 GuiHelper.runInEDT(() -> 106 JOptionPane.showMessageDialog(Main.parent, 101 107 tr("Town/city {0} not found or not available\n" + 102 "or action canceled", wmsLayer.getLocation())) ;108 "or action canceled", wmsLayer.getLocation()))); 103 109 return false; 104 110 } … … 191 197 } 192 198 193 p ublicvoid setCookie() {199 private void setCookie() { 194 200 this.urlConn.setRequestProperty("Cookie", this.cookie); 195 201 } … … 591 597 lastWMSLayerName = null; 592 598 } 599 600 public InputStream getContent(URL url) throws IOException, OsmTransferException { 601 urlConn = (HttpURLConnection) url.openConnection(); 602 urlConn.setRequestProperty("Connection", "close"); 603 urlConn.setRequestMethod("GET"); 604 setCookie(); 605 return new ProgressInputStream(urlConn, NullProgressMonitor.INSTANCE); 606 } 593 607 }
Note:
See TracChangeset
for help on using the changeset viewer.