Changeset 22963 in osm for applications/editors/josm
- Timestamp:
- 2010-09-03T02:29:56+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/AddWMSLayerPanel.java
r22962 r22963 184 184 a.append(serviceUrl.getPath()); 185 185 a.append("?"); 186 if(serviceUrl.getQuery() != null) { 187 a.append(serviceUrl.getQuery()); 188 if (!serviceUrl.getQuery().endsWith("&")) { 189 a.append("&"); 190 } 191 } 186 192 return a.toString(); 187 193 } … … 213 219 214 220 private void attemptGetCapabilities(String serviceUrlStr) { 215 serviceUrl = null;221 URL getCapabilitiesUrl = null; 216 222 try { 217 223 if (!serviceUrlStr.trim().contains("capabilities")) { 218 224 // If the url doesn't already have GetCapabilities, add it in 219 serviceUrl = new URL(serviceUrlStr + "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities");225 getCapabilitiesUrl = new URL(serviceUrlStr + "VERSION=1.1.1&SERVICE=WMS&REQUEST=GetCapabilities"); 220 226 } else { 221 227 // Otherwise assume it's a good URL and let the subsequent error 222 228 // handling systems deal with problems 223 serviceUrl = new URL(serviceUrlStr); 224 } 229 getCapabilitiesUrl = new URL(serviceUrlStr); 230 } 231 serviceUrl = new URL(serviceUrlStr); 225 232 } catch (HeadlessException e) { 226 233 return; … … 231 238 } 232 239 233 System.out.println("Connecting to: " + serviceUrl);240 System.out.println("Connecting to: " + getCapabilitiesUrl); 234 241 235 242 String incomingData; 236 243 try { 237 URLConnection openConnection = serviceUrl.openConnection();244 URLConnection openConnection = getCapabilitiesUrl.openConnection(); 238 245 InputStream inputStream = openConnection.getInputStream(); 239 246 BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); … … 281 288 282 289 try { 283 treeRootNode.setUserObject( serviceUrl.getHost());290 treeRootNode.setUserObject(getCapabilitiesUrl.getHost()); 284 291 Element capabilityElem = getChild(document.getDocumentElement(), "Capability"); 285 292 List<Element> children = getChildren(capabilityElem, "Layer");
Note:
See TracChangeset
for help on using the changeset viewer.