+ /**
+ * Retrieve KVP (keyword-value pairs) parameters, which are lower case, as per
+ * specifications.
+ *
+ * @see https://docs.ogc.org/is/09-025r2/09-025r2.html#19
+ */
+ protected String getKvpParameter(Map<String, List<String>> parameters, String key) {
+ Objects.requireNonNull(key, "KVP key cannot be null");
+ // let's first try the default (CAML case) which should be more efficient
+ List<String> values = parameters.get(key);
+ if (values == null) {
+ // then let's do an ignore case comparison of the key
+ keys: for (String k : parameters.keySet()) {
+ if (key.equalsIgnoreCase(k)) {
+ values = parameters.get(k);
+ break keys;
+ }
+ }
+ }
+ if (values == null) // nothing was found
+ return null;
+ if (values.size() != 1) {
+ // although not completely clear from the standard, we assume keys must be
+ // unique
+ // since lists are defined here
+ // https://docs.ogc.org/is/09-026r2/09-026r2.html#10
+ throw new IllegalArgumentException("Key " + key + " as multiple values");
+ }
+ String value = values.get(0);
+ assert value != null;
+ return value;
+ }
+
+ protected void encodeCollectionAsGeoJSon(Stream<Content> features, OutputStream out, List<QName> typeNames)
+ throws IOException {