Package org.geoserver.ows.util

Examples of org.geoserver.ows.util.KvpMap


                throw new RestletException("Layer not indexable: " + layer,
                        Status.CLIENT_ERROR_FORBIDDEN);
            }

            // create some kvp and pass through to GetMapKvpreader
            KvpMap raw = new KvpMap();
            raw.put("layers", namespace + ":" + layer);
            raw.put("format", "kml");
            raw.put("format_options", "selfLinks:true;relLinks:true;");
            // regionateby:" + regionateBy + (regionateAttr != null ? ";regionateAttr:" + regionateAttr : ""));

            if (feature != null) {
                raw.put("featureid", feature);
            } else {
                raw.put("startIndex", Integer.toString(startIndex));
                raw.put("maxfeatures", Integer.toString(maxFeatures));
            }

            GetMapKvpRequestReader reader = new GetMapKvpRequestReader(getWMS());
            reader.setHttpRequest(RESTUtils.getServletRequest(request));

            // parse into request object
            raw = KvpUtils.normalize(raw);
            KvpMap kvp = new KvpMap(raw);
            KvpUtils.parse(kvp);
            final GetMapRequest getMapRequest = (GetMapRequest) reader.read(
                    (GetMapRequest) reader.createRequest(), kvp, raw);
            getMapRequest.setBaseUrl(RESTUtils.getBaseURL(request));
View Full Code Here


            return;
        }

        //track parsed kvp and unparsd
        Map parsedKvp = KvpUtils.normalize(kvp);
        Map rawKvp = new KvpMap( parsedKvp );
       
        req.setKvp(parsedKvp);
        req.setRawKvp(rawKvp);
    }
View Full Code Here

            return;
        }

        //track parsed kvp and unparsd
        Map parsedKvp = KvpUtils.normalize(kvp);
        Map rawKvp = new KvpMap( parsedKvp );
       
        req.setKvp(parsedKvp);
        req.setRawKvp(rawKvp);
    }
View Full Code Here

     * @param href
     * @param reader
     * @return
     */
    Object kvpParse(String href, KvpRequestReader reader) throws Exception {
        Map original = new KvpMap(KvpUtils.parseQueryString(href));
        KvpUtils.normalize(original);
        Map parsed = new KvpMap(original);
        List<Throwable> errors = KvpUtils.parse(parsed);
        if (errors.size() > 0) {
            throw new WPSException("Failed to parse KVP request", errors.get(0));
        }

View Full Code Here

     * Returns the version from the kvp request
     * @param href
     * @return
     */
    String getVersion(String href) {
        return (String) new KvpMap(KvpUtils.parseQueryString(href)).get("VERSION");
    }
View Full Code Here

            // be the filter and encoding it property... especially for joins that might be
            // tricky, and it also may cause the request to be too large for a get request
            //TODO: figure out what the spec says about this...
            Map<String,String> kvp = null;
            if (req.isGet()) {
                kvp = new KvpMap(req.getRawKvp());
            }
            else {
                //generate kvp map from request object
                kvp = buildKvpFromRequest(request);
            }
View Full Code Here

       
        // FILTER_LANGUAGE
        // RESOURCEID
        // BBOX
        // STOREDQUERY_ID
        KvpMap kvp = new KvpMap();
       
        // SERVICE
        // VERSION
        // REQUEST
        kvp.put("SERVICE", "WFS");
        kvp.put("REQUEST", "GetFeature");
        kvp.put("VERSION", request.getVersion());
       
        // OUTPUTFORMAT
        // RESULTTYPE
        kvp.put("OUTPUTFORMAT", request.getOutputFormat());
        kvp.put("RESULTTYPE", request.isResultTypeHits()
            ? ResultTypeType.HITS.name() : ResultTypeType.RESULTS.name());

        // TYPENAMES
        // PROPERTYNAME
        // ALIASES
        // SRSNAME
        // FILTER
        // SORTBY
        List<Query> queries = request.getQueries();
        Query q = queries.get(0);
        if (q.getSrsName() != null) {
            kvp.put("SRSNAME", q.getSrsName().toString());
        }

        StringBuilder typeNames = new StringBuilder();
        StringBuilder propertyName = !q.getPropertyNames().isEmpty() ? new StringBuilder() : null;
        StringBuilder aliases = !q.getAliases().isEmpty() ? new StringBuilder() : null;
        StringBuilder filter = q.getFilter() != null && q.getFilter() != Filter.INCLUDE ?
            new StringBuilder() : null;
       
        encodeQueryAsKvp(q, typeNames, propertyName, aliases, filter, true);
        if (queries.size() > 1) {
            for (int i = 1; i < queries.size(); i++) {
                encodeQueryAsKvp(queries.get(i), typeNames, propertyName, aliases, filter, true);
            }
        }

        kvp.put("TYPENAMES", typeNames.toString());
        if (propertyName != null) {
            kvp.put("PROPERTYNAME", propertyName.toString());
        }
        if (aliases != null) {
            kvp.put("ALIASES", aliases.toString());
        }
        if (filter != null) {
            kvp.put("FILTER", filter.toString());
        }
        return kvp;
    }
View Full Code Here

        request.setSRS("EPSG:4326");

        // proxy aware base url?
        String baseurl = getRequest().getRootRef().getParentRef().toString();
        request.setBaseUrl(baseurl);
        request.setRawKvp(new KvpMap());
        int maxFeatures = 1000;
        if (info instanceof LayerGroupInfo) {
            maxFeatures = maxFeatures / ((LayerGroupInfo) info).getLayers().size();
        }
        request.setMaxFeatures(maxFeatures);
View Full Code Here

    }
   
    KvpMap toKvpMap(String url) {
        url = url.substring(url.indexOf('?')+1);
        String[] kvps = url.split("\\&");
        KvpMap map = new KvpMap();
        for (String kvp : kvps) {
            map.put(kvp.split("=")[0], kvp.split("=")[1]);
        }
        return map;
    }
View Full Code Here

        //check if this uri is a reflective one
        if (uriIsReflective(uri)) {
            // it is, check the query string to determine if it is a DescribeFeatureType request
            String q = uri.query();
            if (q != null && !"".equals(q.trim())) {
                KvpMap kv = parseQueryString(q);

                if ("DescribeFeatureType".equalsIgnoreCase((String)kv.get("REQUEST")) ||
                        (uri.path().endsWith("DescribeFeatureType"))) {
                   return true;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.geoserver.ows.util.KvpMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.