Changeset 13346 in josm


Ignore:
Timestamp:
2018-01-20T19:54:16+01:00 (4 months ago)
Author:
Don-vip
Message:

WMS capabilities: support 1.3.0-only servers such as http://www.umweltkarten-niedersachsen.de/arcgis/services/WRRL_wms/MapServer/WMSServer?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r13328 r13346  
    235235        }
    236236
     237        doAttemptGetCapabilities(serviceUrlStr, getCapabilitiesUrl);
     238    }
     239
     240    private void doAttemptGetCapabilities(String serviceUrlStr, URL getCapabilitiesUrl)
     241            throws IOException, WMSGetCapabilitiesException {
    237242        final Response response = HttpClient.create(getCapabilitiesUrl).connect();
    238243
     
    241246        }
    242247
    243         parseCapabilities(serviceUrlStr, response.getContent());
     248        try {
     249            parseCapabilities(serviceUrlStr, response.getContent());
     250        } catch (WMSGetCapabilitiesException e) {
     251            String url = getCapabilitiesUrl.toExternalForm();
     252            // ServiceException for servers handling only WMS 1.3.0 ?
     253            if (e.getCause() == null && url.contains("VERSION=1.1.1")) {
     254                doAttemptGetCapabilities(serviceUrlStr, new URL(url.replace("VERSION=1.1.1", "VERSION=1.3.0")));
     255                if (serviceUrl.toExternalForm().contains("VERSION=1.1.1")) {
     256                    serviceUrl = new URL(serviceUrl.toExternalForm().replace("VERSION=1.1.1", "VERSION=1.3.0"));
     257                }
     258            } else {
     259                throw e;
     260            }
     261        }
    244262    }
    245263
Note: See TracChangeset for help on using the changeset viewer.