Package org.geoserver.wms

Examples of org.geoserver.wms.GetMapRequest


        Response response = cachedTileEncoders.get(format);
        if (response == null) {
            final Operation operation;
            {
                GetMapRequest getMap = new GetMapRequest();
                getMap.setFormat(mimeType);
                Object[] parameters = { getMap };
                org.geoserver.platform.Service service = (org.geoserver.platform.Service) GeoServerExtensions
                        .bean("wms-1_1_1-ServiceDescriptor");
                if (service == null) {
                    throw new IllegalStateException(
View Full Code Here


        GWCConfig config = gwc.getConfig();
        if (!config.isDirectWMSIntegrationEnabled()) {
            return (WebMap) invocation.proceed();
        }

        final GetMapRequest request = getRequest(invocation);
        boolean tiled = request.isTiled();
        if (!tiled) {
            return (WebMap) invocation.proceed();
        }

        final StringBuilder requestMistmatchTarget = new StringBuilder();
        ConveyorTile cachedTile = gwc.dispatch(request, requestMistmatchTarget);

        if (cachedTile == null) {
            WebMap dynamicResult = (WebMap) invocation.proceed();
            dynamicResult.setResponseHeader("geowebcache-cache-result", MISS.toString());
            dynamicResult.setResponseHeader("geowebcache-miss-reason",
                    requestMistmatchTarget.toString());
            return dynamicResult;
        }
        checkState(cachedTile.getTileLayer() != null);
        final TileLayer layer = cachedTile.getTileLayer();

        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("GetMap request intercepted, serving cached content: " + request);
        }

        final byte[] tileBytes;
        {
            final Resource mapContents = cachedTile.getBlob();
            if (mapContents instanceof ByteArrayResource) {
                tileBytes = ((ByteArrayResource) mapContents).getContents();
            } else {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                mapContents.transferTo(Channels.newChannel(out));
                tileBytes = out.toByteArray();
            }
        }

        // Handle Etags
        final String ifNoneMatch = request.getHttpRequestHeader("If-None-Match");
        final byte[] hash = MessageDigest.getInstance("MD5").digest(tileBytes);
        final String etag = toHexString(hash);
        if (etag.equals(ifNoneMatch)) {
            // Client already has the current version
            LOGGER.finer("ETag matches, returning 304");
View Full Code Here

        final Object[] arguments = invocation.getArguments();

        checkArgument(arguments.length == 1);
        checkArgument(arguments[0] instanceof GetMapRequest);

        final GetMapRequest request = (GetMapRequest) arguments[0];
        return request;
    }
View Full Code Here

        if(!(context.getService() instanceof WMSInfo)) {
            return null;
        }
       
        // see if we have to encode a legend
        GetMapRequest request = context.getRequest();
        Boolean legend = (Boolean) request.getFormatOptions().get("legend");
        if (legend != null && legend && Document.class.isAssignableFrom(featureClass)) {
            return new LegendDecorator();
        } else {
            return null;
        }
View Full Code Here

        cfg.setObjectWrapper(new BeansWrapper());

        Template template = cfg.getTemplate("OpenLayers2MapTemplate.ftl");
        assertNotNull(template);

        GetMapRequest request = createGetMapRequest(MockData.BASIC_POLYGONS);
        WMSMapContent mapContent = new WMSMapContent();
        mapContent.addLayer(createMapLayer(MockData.BASIC_POLYGONS));
        mapContent.setRequest(request);
        mapContent.setMapWidth(256);
        mapContent.setMapHeight(256);
View Full Code Here

    public void testFrameCatalog() throws Exception {
      final WebMapService wms = (WebMapService) applicationContext.getBean("wmsService2");
      final String layerName = MockData.BASIC_POLYGONS.getPrefix() + ":" +
          MockData.BASIC_POLYGONS.getLocalPart();
     
      GetMapRequest getMapRequest = createGetMapRequest(new QName(layerName));
     
      FrameCatalog catalog = null;
      try {
        catalog = new FrameCatalog(getMapRequest, wms, getWMS());
      } catch (RuntimeException e) {
        assertEquals("Missing \"animator\" mandatory params \"aparam\" and \"avalues\".", e.getLocalizedMessage());
      }
     
      getMapRequest.getRawKvp().put("aparam", "fake_param");
      getMapRequest.getRawKvp().put("avalues", "val0,val\\,1,val2\\,\\,,val3");
     
      catalog = new FrameCatalog(getMapRequest, wms, getWMS());
     
      assertNotNull(catalog);
      assertEquals("fake_param", catalog.getParameter());
View Full Code Here

    public void testFrameVisitor() throws Exception {
      final WebMapService wms = (WebMapService) applicationContext.getBean("wmsService2");
      final String layerName = MockData.BASIC_POLYGONS.getPrefix() + ":" +
          MockData.BASIC_POLYGONS.getLocalPart();
     
      GetMapRequest getMapRequest = createGetMapRequest(new QName(layerName));
     
      FrameCatalog catalog = null;
     
      getMapRequest.getRawKvp().put("aparam", "fake_param");
      getMapRequest.getRawKvp().put("avalues", "val0,val\\,1,val2\\,\\,,val3");
      getMapRequest.getRawKvp().put("format", GIF_ANIMATED_FORMAT);
      getMapRequest.getRawKvp().put("LAYERS", layerName);
     
      catalog = new FrameCatalog(getMapRequest, wms, getWMS());
     
      assertNotNull(catalog);
View Full Code Here

    public Object read(Object request, Reader reader, Map kvp) throws Exception {
        if ( request == null ) {
            throw new IllegalArgumentException( "request must be not null" );
        }
       
        GetMapRequest getMap = (GetMapRequest) request;
        StyledLayerDescriptor sld =
            Styles.handler(getMap.getStyleFormat()).parse(reader, getMap.styleVersion(), null, null);

        //process the sld
        GetMapKvpRequestReader.processStandaloneSld(wms, getMap, sld);
   
        return getMap;
View Full Code Here

        FeatureSource featureSource = layer.getFeatureSource();
        Name typeName = featureSource.getSchema().getName();
        String nsUri = typeName.getNamespaceURI();
        NamespaceInfo ns = catalog.getNamespaceByURI(nsUri);
        String featureTypeName = typeName.getLocalPart();
        GetMapRequest request = context.getRequest();
        String baseURL = request.getBaseUrl();
        String prefix = ns.getPrefix();
        return buildURL(baseURL, appendPath("rest", prefix, featureTypeName), null,
                URLType.SERVICE);
    }
View Full Code Here

        if(!(featureClass.equals(Folder.class))) {
            return null;
        }
       
        // see if we have to encode relative links
        GetMapRequest request = context.getRequest();
        String relLinks = (String) request.getFormatOptions().get("relLinks");
        // Add prev/next links if requested
        if(request.getMaxFeatures() != null && relLinks != null
                && relLinks.equalsIgnoreCase("true")) {
            return new FolderRelativeLinksDecorator();
        } else {
            return null;
        }
View Full Code Here

TOP

Related Classes of org.geoserver.wms.GetMapRequest

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.