Package org.geoserver.ows

Examples of org.geoserver.ows.Request


            }
        }
    }

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


    @Test
    public void testConcurrentRequestsSingleIPAddress() {
        // an ip based flow controller that will allow just one request at a time
        IpFlowController controller = new IpFlowController(1);
        String ipAddress = "127.0.0.1";
        Request firstRequest = buildIpRequest(ipAddress, "");
        FlowControllerTestingThread tSample = new FlowControllerTestingThread(firstRequest,
                0, 0, controller);
        tSample.start();
        waitTerminated(tSample, MAX_WAIT);

        assertEquals(ThreadState.COMPLETE, tSample.state);

        String ip = firstRequest.getHttpRequest().getRemoteAddr();

        // make three testing threads that will "process" forever, and will use the ip to identify themselves
        // as the same client, until we interrupt them
        FlowControllerTestingThread t1 = new FlowControllerTestingThread(buildIpRequest(
                ip, ""), 0, Long.MAX_VALUE, controller);
View Full Code Here

    public void testUserAndIPAddressFlowControl() {
        // an ip based flow controller that will allow just one request at a time
        IpFlowController ipController = new IpFlowController(1);
        UserConcurrentFlowController userController = new UserConcurrentFlowController(1);
        String ipAddress = "127.0.0.1";
        Request firstRequest = buildIpRequest(ipAddress, "");
        FlowControllerTestingThread tSample = new FlowControllerTestingThread(firstRequest,
                0, 0, userController, ipController);
        tSample.start();
        waitTerminated(tSample, MAX_WAIT);

        assertEquals(ThreadState.COMPLETE, tSample.state);

        String ip = firstRequest.getHttpRequest().getRemoteAddr();

        // make three testing threads that will "process" forever, and will use the ip to identify themselves
        // as the same client, until we interrupt them
        FlowControllerTestingThread t1 = new FlowControllerTestingThread(buildIpRequest(
                ip, ""), 0, Long.MAX_VALUE, ipController);
View Full Code Here

    @Test
    public void testConcurrentProxiedIPAddresses() {
        IpFlowController controller = new IpFlowController(1);
        String ipAddress = "192.168.1.1";

        Request firstRequest = buildIpRequest(ipAddress, "");

        String ip = firstRequest.getHttpRequest().getRemoteAddr();

        FlowControllerTestingThread t1 = new FlowControllerTestingThread(buildIpRequest(
                ip, "192.168.1.2"), 0, Long.MAX_VALUE, controller);
        FlowControllerTestingThread t2 = new FlowControllerTestingThread(buildIpRequest(
                ip, "192.168.1.3"), 0, Long.MAX_VALUE, controller);
View Full Code Here

        if (offset > 0 || count < Integer.MAX_VALUE) {
            //paged request, set the values of previous and next

            //get the Request thread local since we need to know about the request, whether it is
            // GET or POST some kvp information if the former
            Request req = Dispatcher.REQUEST.get();
           
            //grab the original kvp params if this is a GET request
            //for POST, do nothing, make the client post the same content
            //TODO: try to encode the request as best we can in a GET request, only issue should
            // 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

        this.policy = policy;
    }

    @Override
    public AbstractGridFormat getFormat() {
        Request request = Dispatcher.REQUEST.get();
        if(policy.level == AccessLevel.METADATA &&
                (request == null || !"GetCapabilities".equalsIgnoreCase(request.getRequest()))) {
            throw SecureCatalogImpl.unauthorizedAccess(this.getName());
        }
        return super.getFormat();
    }
View Full Code Here

    WMS wms;

    @Override
    public DimensionDefaultValueSelectionStrategy getStrategy(ResourceInfo resource,
            String dimensionName, DimensionInfo dimension) {
        Request request = Dispatcher.REQUEST.get();
        DefaultValueConfigurations config = getConfigurations(resource);
        if (config != null
                && request != null
                && ("GetMap".equalsIgnoreCase(request.getRequest()) || "GetFeatureInfo"
                        .equalsIgnoreCase(request.getRequest()))) {
            GetMapRequest getMap = getGetMap(request);
            try {
                Map<String, Object> defaults = getDefaultValues(resource, getMap, config);

                String key = dimensionName;
View Full Code Here

        assertEquals(Filter.INCLUDE, vl.getWriteFilter());
        assertNull(vl.getReadAttributes());
        assertNull(vl.getWriteAttributes());

        // check layer in the sf workspace with a wfs request
        Request request = new Request();
        request.setService("WFS");
        request.setRequest("GetFeature");
        Dispatcher.REQUEST.set(request);

        LayerInfo generic = getCatalog().getLayerByName(getLayerId(MockData.GENERICENTITY));
        vl = (VectorAccessLimits) accessManager.getAccessLimits(user, generic);
        assertEquals(Filter.EXCLUDE, vl.getReadFilter());
        assertEquals(Filter.EXCLUDE, vl.getWriteFilter());

        // now fake a getmap request (using a service and request with a different case than the
        // geofenceService)
        request = new Request();
        request.setService("WmS");
        request.setRequest("gETmAP");
        Dispatcher.REQUEST.set(request);
        vl = (VectorAccessLimits) accessManager.getAccessLimits(user, generic);
        assertEquals(Filter.INCLUDE, vl.getReadFilter());
        assertEquals(Filter.INCLUDE, vl.getWriteFilter());
    }
View Full Code Here

    {
        UsernamePasswordAuthenticationToken user = new UsernamePasswordAuthenticationToken(
                "wmsuser", "wmsuser");

        // check layer in the sf workspace with a wfs request
        Request request = new Request();
        request.setService("WFS");
        request.setRequest("GetFeature");
        Dispatcher.REQUEST.set(request);

        LayerInfo generic = getCatalog().getLayerByName(getLayerId(MockData.GENERICENTITY));
        VectorAccessLimits vl = (VectorAccessLimits) accessManager.getAccessLimits(user, generic);
        assertEquals(Filter.EXCLUDE, vl.getReadFilter());
        assertEquals(Filter.EXCLUDE, vl.getWriteFilter());

        // now fake a getmap request (using a service and request with a different case than the
        // geofenceService)
        request = new Request();
        request.setService("wms");
        Dispatcher.REQUEST.set(request);
        vl = (VectorAccessLimits) accessManager.getAccessLimits(user, generic);
        assertEquals(Filter.INCLUDE, vl.getReadFilter());
        assertEquals(Filter.INCLUDE, vl.getWriteFilter());
    }
View Full Code Here

            return false;
        }
       
        // check the format matches, the Dispatcher just does a case insensitive match,
        // but WFS is supposed to be case sensitive and so is the XSLT code
        Request request = Dispatcher.REQUEST.get();
        if(request != null && (request.getOutputFormat() == null || !formats.containsKey(request.getOutputFormat()))) {
            System.out.println("Formats are: " + formats);
            return false;
        } else {
            return true;
        }
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.