Package org.geoserver.ows

Examples of org.geoserver.ows.Request


        if (env != null)
            kvp.put("BBOX", env);
        if (srsName != null)
            kvp.put("SRS", srsName);

        Request owsRequest = EasyMock.createMock(Request.class);
        EasyMock.expect(owsRequest.getService()).andReturn("wms").anyTimes();
        EasyMock.expect(owsRequest.getRequest()).andReturn(requestName).anyTimes();
        EasyMock.expect(owsRequest.getKvp()).andReturn(kvp).anyTimes();
        EasyMock.replay(owsRequest);
        Dispatcher.REQUEST.set(owsRequest);
    }
View Full Code Here


    }

    @Override
    public GridCoverageReader getGridCoverageReader(ProgressListener listener,
            Hints hints) throws IOException {
        Request request = Dispatcher.REQUEST.get();
        if(policy.level == AccessLevel.METADATA &&
                (request == null || !"GetCapabilities".equalsIgnoreCase(request.getRequest()))) {
            throw SecureCatalogImpl.unauthorizedAccess(this.getName());
        }
        GridCoverageReader reader = super.getGridCoverageReader(listener, hints);
        return (GridCoverageReader) SecuredObjects.secure(reader, policy);
    }
View Full Code Here

     * Returns an eventual filter included among the parsed kvp map of the current
     * request. Will work for CQL_FILTER, FILTER and FEATURE_ID
     * @return
     */
    public static Filter getRequestFilter() {
        Request request = Dispatcher.REQUEST.get();
        if(request == null) {
            return null;
        }
        Object filter = request.getKvp().get("FILTER");
        if(!(filter instanceof Filter)) {
            filter = request.getKvp().get("CQL_FILTER");
            if(filter instanceof List) {
                List list = (List) filter;
                if(list.size() > 0) {
                    filter = list.get(0);
                }
            }
        }
        if(!(filter instanceof Filter)) {
            filter = request.getKvp().get("FEATURE_ID");
        }
       
        if(filter instanceof Filter) {
            return (Filter) filter;
        } else {
View Full Code Here

            addAttribute(attributes, "timeStamp", Converters.convert(new Date(), String.class));

            start("csw:Acknowledgement", attributes);
            start("csw:EchoedRequest");

            Request request = Dispatcher.REQUEST.get();
            if (request.isGet()) {
                encodeGetEcho(request);
            } else {
                encodePostEcho();
            }
View Full Code Here

        if (errors.size() > 0) {
            throw new WPSException("Failed to parse KVP request", errors.get(0));
        }

        // hack to allow wcs filters to work... we should really upgrade the WCS models instead...
        Request r = Dispatcher.REQUEST.get();
        if (r != null) {
            Map kvp = new HashMap(r.getKvp());
            r.setKvp(new CaseInsensitiveMap(parsed));
        }

        return reader.read(reader.createRequest(), parsed, original);
    }
View Full Code Here

            // if in hide mode, we just hide the resource
            if (mode == CatalogMode.HIDE) {
                return WrapperPolicy.hide(limits);
            } else if (mode == CatalogMode.MIXED) {
                // if request is a get capabilities and mixed, we hide again
                Request request = Dispatcher.REQUEST.get();
                if(request != null && "GetCapabilities".equalsIgnoreCase(request.getRequest()))
                    return WrapperPolicy.hide(limits);
                // otherwise challenge the user for credentials
                else
                    throw unauthorizedAccess(resourceName);
            } else {
View Full Code Here

   
        };
        outputFormat.templateLoader = templateLoader;
       
        // test request with some parameters to use in templates
        Request request = new Request();
        parameters = new HashMap<String, Object>();
        parameters.put("LAYER", "testLayer");       
        Map<String, String> env = new HashMap<String, String>();
        env.put("TEST1", "VALUE1");
        env.put("TEST2", "VALUE2");       
        parameters.put("ENV", env);
        request.setKvp(parameters);
       
        Dispatcher.REQUEST.set(request);
       
        final FeatureTypeInfo featureType = getFeatureTypeInfo(MockData.PRIMITIVEGEOFEATURE);
       
View Full Code Here

            throw serviceException;
        }
    }

    private static String getCallbackFunction() {
        Request request = Dispatcher.REQUEST.get();
        if (request == null) {
            return JSONType.CALLBACK_FUNCTION;
        } else {
            return JSONType.getCallbackFunction(request.getKvp());
        }
    }
View Full Code Here

        return disposition;
    }
   
    public String getAttachmentFileName() {       
        // see if we can get the original request, before the group expansion happened
        Request request = Dispatcher.REQUEST.get();
        String filename = null;
        if(request != null && request.getRawKvp() != null && request.getRawKvp().get("LAYERS") != null) {
            String layers = ((String) request.getRawKvp().get("LAYERS")).trim();
            if(layers.length() > 0) {
                filename = layers.replace(",", "_");
            }
        }
        if(filename == null && mapContent != null) {
View Full Code Here

       
        SecureCatalogImpl sc = buildTestObject("lockedDownMixed.properties", catalog);

        // try with read only user and GetFeatures request
        SecurityContextHolder.getContext().setAuthentication(roUser);
        Request request = org.easymock.classextension.EasyMock.createNiceMock(Request.class);
        org.easymock.classextension.EasyMock.expect(request.getRequest()).andReturn("GetFeatures").anyTimes();
        org.easymock.classextension.EasyMock.replay(request);
        Dispatcher.REQUEST.set(request);

        // check a direct access does trigger a security challenge
        try {
            sc.getFeatureTypeByName("topp:states");
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getCoverageByName("nurc:arcgrid");
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getResourceByName("topp:states", FeatureTypeInfo.class);
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getResourceByName("nurc:arcgrid", CoverageInfo.class);
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getWorkspaceByName("topp");
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getDataStoreByName("states");
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getDataStoreByName("roads");
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
        try {
            sc.getCoverageStoreByName("arcGrid");
            fail("Should have failed with a security exception");
        } catch(Exception e) {
            if (ReadOnlyDataStoreTest.isSpringSecurityException(e)==false)
                fail("Should have failed with a security exception");
        }
       
        // try with a getCapabilities, make sure the lists are empty
        request = org.easymock.classextension.EasyMock.createNiceMock(Request.class);
        org.easymock.classextension.EasyMock.expect(request.getRequest()).andReturn("GetCapabilities").anyTimes();
        org.easymock.classextension.EasyMock.replay(request);
        Dispatcher.REQUEST.set(request);
       
        // check the lists used to build capabilities are empty
        assertThatBoth(
View Full Code Here

TOP

Related Classes of org.geoserver.ows.Request

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.