public Object parse(String value) throws Exception { List<String> versions = KvpUtils.readFlat(value); for (String version : versions) { RequestUtils.checkVersionNumber(version, "AcceptVersions"); } AcceptVersionsType accepts = Ows11Factory.eINSTANCE.createAcceptVersionsType(); accepts.getVersion().addAll(versions); return accepts; } }
public Object parse(String value) throws Exception { List<String> versions = KvpUtils.readFlat(value); for (String version : versions) { RequestUtils.checkVersionNumber(version, "AcceptVersions"); } AcceptVersionsType accepts = Ows11Factory.eINSTANCE.createAcceptVersionsType(); accepts.getVersion().addAll(versions); return accepts; } }
public Object read(Object request, Map kvp, Map rawKvp) throws Exception { // make sure we get the right accepts versions param -> workaround for GEOS-1719 if(rawKvp.containsKey("acceptVersions")) { AcceptVersionsKvpParser avp = new AcceptVersionsKvpParser(); AcceptVersionsType avt = (AcceptVersionsType) avp.parse((String) rawKvp.get("acceptVersions")); kvp.put("acceptVersions", avt); } request = super.read(request, kvp, rawKvp); // set the version attribute on the request if (kvp.containsKey("version")) { AcceptVersionsType acceptVersions = Ows11Factory.eINSTANCE.createAcceptVersionsType(); acceptVersions.getVersion().add(kvp.get("version")); GetCapabilitiesType getCapabilities = (GetCapabilitiesType) request; getCapabilities.setAcceptVersions(acceptVersions); } return request; } }
public WCSCapsTransformer getCapabilities(GetCapabilitiesType request) { // do the version negotiation dance List<String> provided = new ArrayList<String>(); // provided.add("1.0.0"); provided.add("1.1.0"); provided.add("1.1.1"); List<String> accepted = null; if (request.getAcceptVersions() != null) accepted = request.getAcceptVersions().getVersion(); String version = RequestUtils.getVersionOws11(provided, accepted); // TODO: add support for 1.0.0 in here if ("1.1.0".equals(version) || "1.1.1".equals(version)) { WCSCapsTransformer capsTransformer = new WCSCapsTransformer(wcs, catalog); capsTransformer.setEncoding(wcs.getCharSet()); return capsTransformer; } throw new WcsException("Could not understand version:" + version); }
public WCSCapsTransformer getCapabilities(GetCapabilitiesType request) { // do the version negotiation dance List<String> provided = new ArrayList<String>(); // provided.add("1.0.0"); provided.add("1.1.0"); provided.add("1.1.1"); List<String> accepted = null; if (request.getAcceptVersions() != null) accepted = request.getAcceptVersions().getVersion(); String version = RequestUtils.getVersionOws11(provided, accepted); // TODO: add support for 1.0.0 in here if ("1.1.0".equals(version) || "1.1.1".equals(version)) { WCSCapsTransformer capsTransformer = new WCSCapsTransformer(geoServer); capsTransformer.setEncoding( Charset.forName((getServiceInfo().getGeoServer().getSettings().getCharset()))); return capsTransformer; } throw new WcsException("Could not understand version:" + version); }
(GetCapabilitiesType) reader.read(null, new StringReader(request), null); assertEquals("WCS", cap.getService()); assertEquals(1, cap.getAcceptVersions().getVersion().size()); assertEquals("1.0.0", cap.getAcceptVersions().getVersion().get(0)); assertEquals(1, cap.getSections().getSection().size()); assertEquals("Section1", cap.getSections().getSection().get(0));
List<String> accepted = null; if (request.getAcceptVersions() != null) accepted = request.getAcceptVersions().getVersion(); String version = RequestUtils.getVersionOws11(provided, accepted);
List<String> accepted = null; if (request.getAcceptVersions() != null) accepted = request.getAcceptVersions().getVersion(); String version = RequestUtils.getVersionOws11(provided, accepted);