@Override public Object read(Object request, Map kvp, Map rawKvp) throws Exception { request = super.read(request, kvp, rawKvp); // set the version attribute on the request if (kvp.containsKey("version")) { GetCapabilitiesRequest req = GetCapabilitiesRequest.adapt(request); // TODO: put this check in a cite hack if (req.getAcceptVersions() == null || req.getAcceptVersions().isEmpty()) { req.setAcceptVersions((String) kvp.get("version")); } } return request; } }
public void setAcceptVersions(String... versions) { Object acceptedVersions = createAcceptedVersions(); eAdd(acceptedVersions, "version", Arrays.asList(versions)); eSet(adaptee, "acceptVersions", acceptedVersions); }
public String getUpdateSequence() { return eGet(adaptee, "updateSequence", String.class); }
public String getMimeType(Object value, Operation operation) { GetCapabilitiesRequest request = GetCapabilitiesRequest.adapt(operation.getParameters()[0]); if ((request != null) && (request.getAcceptFormats() != null)) { // look for an accepted format List formats = request.getAcceptFormats(); for (Iterator f = formats.iterator(); f.hasNext(); ) { String format = (String) f.next(); if (format.endsWith("/xml")) { return format; } } } // default return "application/xml"; }
public void encode(Object object) throws IllegalArgumentException { request = GetCapabilitiesRequest.adapt(object); .CANONICAL_SCHEMA_LOCATION_CAPABILITIES : buildSchemaURL( request.getBaseUrl(), "wfs/1.0.0/WFS-capabilities.xsd")); attributes.addAttribute("", locationAtt, locationAtt, "", locationDef);
@Test public void test0() throws Exception { // test when provided and accepted match up GetCapabilitiesType request = factory.createGetCapabilitiesType(); request.setService("WFS"); request.setAcceptVersions(owsFactory.createAcceptVersionsType()); request.getAcceptVersions().getVersion().add("1.0.0"); request.getAcceptVersions().getVersion().add("1.1.0"); TransformerBase tx = getCaps.run(GetCapabilitiesRequest.adapt(request)); assertTrue(tx instanceof CapabilitiesTransformer.WFS1_1); }
if (request.getUpdateSequence() != null) { throw new WFSException(request, "Invalid update sequence", "InvalidUpdateSequence"); if (!request.isSetService()) { String baseUrl = request.getBaseUrl(); final CapabilitiesTransformer capsTransformer; if ("1.0.0".equals(version)) {
GetCapabilitiesRequest.adapt( OwsUtils.parameter(operation.getParameters(), EObject.class)); if (caps != null) { caps.setNamespace(workspace.getName()); return;
onlineResource = buildURL( request.getBaseUrl(), "wfs", params("request", capabilityName), } else { onlineResource = buildURL(request.getBaseUrl(), "wfs", null, URLType.SERVICE); appendQueryString(onlineResource, "");
protected void featureTypes() { // featureTypes(false, "urn:x-ogc:def:crs:", request.getNamespace()); featureTypes(false, request.getNamespace()); }
public void setNamespace(String namespace) { eSet(adaptee, "namespace", namespace); }
public static String version(GetCapabilitiesRequest request) { // do the version negotiation dance List<String> provided = new ArrayList<String>(); provided.add("1.0.0"); provided.add("1.1.0"); if (request instanceof GetCapabilitiesRequest.WFS20) { provided.add("2.0.0"); } List<String> accepted = request.getAcceptVersions(); String version = RequestUtils.getVersionPreOws(provided, accepted); return version; } }
/** Returns the list of requested sections (never null or emtpy) */ protected Set<Sections> getSections(GetCapabilitiesRequest request) { List<String> sectionNames = request.getSections(); if (sectionNames == null || sectionNames.isEmpty()) { return ALL_SECTIONS; } Set<Sections> sections = new HashSet<>(); for (String sectionName : sectionNames) { try { Sections section = Sections.valueOf(sectionName); sections.add(section); } catch (IllegalArgumentException e) { WFSException exception = new WFSException( request, "Unknown section " + sectionName, "InvalidParameterValue"); exception.setLocator("sections"); throw exception; } } if (sections.contains(Sections.All)) { return ALL_SECTIONS; } return sections; }
public void encode(Object o) throws IllegalArgumentException { request = GetCapabilitiesRequest.adapt(o); delegate.request = request; schemaLocation.append(org.geotools.wfs.v2_0.WFS.CANONICAL_SCHEMA_LOCATION); } else { schemaLocation.append(buildSchemaURL(request.getBaseUrl(), "wfs/2.0/wfs.xsd"));
@Test public void test2() throws Exception { // test accepted only 1.1 GetCapabilitiesType request = factory.createGetCapabilitiesType(); request.setService("WFS"); request.setAcceptVersions(owsFactory.createAcceptVersionsType()); request.getAcceptVersions().getVersion().add("1.1.0"); TransformerBase tx = getCaps.run(GetCapabilitiesRequest.adapt(request)); assertTrue(tx instanceof CapabilitiesTransformer.WFS1_1); }
element( "MetadataURL", ResponseUtils.proxifyMetadataLink(link, request.getBaseUrl()), mtAtts);
protected void featureTypeList() { if (catalog.getFeatureTypes().isEmpty()) { return; } start("FeatureTypeList"); // TODO: namespace filtering delegate.featureTypes(true, request.getNamespace()); end("FeatureTypeList"); }
public void encode(Object object) throws IllegalArgumentException { request = GetCapabilitiesRequest.adapt(object); } else { schemaLocation.append( buildSchemaURL(request.getBaseUrl(), "wfs/1.1.0/wfs.xsd"));
@Test public void test5() throws Exception { // test accepted = 0.0.0 GetCapabilitiesType request = factory.createGetCapabilitiesType(); request.setService("WFS"); request.setAcceptVersions(owsFactory.createAcceptVersionsType()); request.getAcceptVersions().getVersion().add("0.0.0"); TransformerBase tx = getCaps.run(GetCapabilitiesRequest.adapt(request)); assertTrue(tx instanceof CapabilitiesTransformer.WFS1_0); }
boolean post) { start("ows:Operation", attributes(new String[] {"name", name})); String serviceURL = buildURL(request.getBaseUrl(), "wfs", null, URLType.SERVICE);