Package org.geowebcache

Examples of org.geowebcache.GeoWebCacheException


            }
            long requestTime = System.currentTimeMillis();
            sourceHelper.makeRequest(metaTile, buffer);

            if (metaTile.getError()) {
                throw new GeoWebCacheException("Empty metatile, error message: "
                        + metaTile.getErrorMessage());
            }

            if (saveExpirationHeaders) {
                // Converting to seconds
View Full Code Here


        ByteArrayResource buffer = getImageBuffer(WMS_BUFFER);
        sourceHelper.makeRequest(tile, buffer);

        if (tile.getError() || buffer.getSize() == 0) {
            throw new GeoWebCacheException("Empty tile, error message: " + tile.getErrorMessage());
        }

        tile.setBlob(buffer);
        return tile;
    }
View Full Code Here

                url = new URL(serverStr + queryStr);
            }
           
            WMSSourceHelper helper = getSourceHelper();
            if(! (helper instanceof WMSHttpHelper)) {
               throw new GeoWebCacheException("Can only proxy if WMS Layer is backed by an HTTP backend");
            }

            getMethod = ((WMSHttpHelper) helper).executeRequest(url, null, getBackendTimeout());
            is = getMethod.getResponseBodyAsStream();
View Full Code Here

                    // order to keep backwards compatibility with the old behaviour
                    if (tileFailureRetryCount == 0) {
                        if (e instanceof GeoWebCacheException) {
                            throw (GeoWebCacheException) e;
                        }
                        throw new GeoWebCacheException(e);
                    }

                    long sharedFailureCount = sharedFailureCounter.incrementAndGet();
                    if (sharedFailureCount >= totalFailuresBeforeAborting) {
                        log.info("Aborting seed thread " + Thread.currentThread().getName()
View Full Code Here

        }

        GridSubset gridSubset = tl.getGridSubset(gridSetId);

        if (gridSubset == null) {
            throw new GeoWebCacheException("Unknown grid set " + gridSetId);
        }

        long[][] coveredGridLevels;

        BoundingBox bounds = req.getBounds();
View Full Code Here

        TileLayer layer = null;

        layer = layerDispatcher.getTileLayer(layerName);

        if (layer == null) {
            throw new GeoWebCacheException("Uknown layer: " + layerName);
        }

        return layer;
    }
View Full Code Here

            } else {
                // see if we can proxy the request
                TileLayer tl = tld.getTileLayer(tile.getLayerId());

                if(tl == null) {
                    throw new GeoWebCacheException(tile.getLayerId() + " is unknown.");
                }
               
                if(tl instanceof ProxyLayer) {
                    ((ProxyLayer) tl).proxyRequest(tile);
                } else {
                    throw new GeoWebCacheException(tile.getLayerId() + " cannot cascade WMS requests.");
                }
            }
        } else {
            throw new GeoWebCacheException("The WMS Service would love to help, "
                    + "but has no idea what you're trying to do?"
                    + "Please include request URL if you file a bug report.");
        }
    }
View Full Code Here

     */
    private void handleGetFeatureInfo(ConveyorTile tile) throws GeoWebCacheException {
        TileLayer tl = tld.getTileLayer(tile.getLayerId());

        if (tl == null) {
            throw new GeoWebCacheException(tile.getLayerId() + " is unknown.");
        }

        String[] keys = { "x", "y", "srs", "info_format", "bbox", "height", "width" };
        Map<String, String> values = ServletUtils.selectedStringsFromMap(
                tile.servletReq.getParameterMap(), tile.servletReq.getCharacterEncoding(), keys);

        // TODO Arent we missing some format stuff here?
        GridSubset gridSubset = tl.getGridSubsetForSRS(SRS.getSRS(values.get("srs")));

        BoundingBox bbox = null;
        try {
            bbox = new BoundingBox(values.get("bbox"));
        } catch (NumberFormatException nfe) {
            log.debug(nfe.getMessage());
        }

        if (bbox == null || !bbox.isSane()) {
            throw new ServiceException("The bounding box parameter (" + values.get("srs")
                    + ") is missing or not sane");
        }

        // long[] tileIndex = gridSubset.closestIndex(bbox);

        MimeType mimeType;
        try {
            mimeType = MimeType.createFromFormat(values.get("info_format"));
        } catch (MimeException me) {
            throw new GeoWebCacheException("The info_format parameter ("
                    + values.get("info_format") + ")is missing or not recognized.");
        }
       
        if (mimeType != null && !tl.getInfoMimeTypes().contains(mimeType)) {
            throw new GeoWebCacheException("The info_format parameter ("
                    + values.get("info_format") + ") is not supported.");
        }

        ConveyorTile gfiConv = new ConveyorTile(sb, tl.getName(), gridSubset.getName(), null,
                mimeType, tile.getFullParameters(), tile.servletReq, tile.servletResp);
        gfiConv.setTileLayer(tl);

        int x, y;
        try {
            x = Integer.parseInt(values.get("x"));
            y = Integer.parseInt(values.get("y"));
        } catch (NumberFormatException nfe) {
            throw new GeoWebCacheException(
                    "The parameters for x and y must both be positive integers.");
        }

        int height, width;
        try {
            height = Integer.parseInt(values.get("height"));
            width = Integer.parseInt(values.get("width"));
        } catch (NumberFormatException nfe) {
            throw new GeoWebCacheException(
                    "The parameters for height and width must both be positive integers.");
        }

        Resource data = tl.getFeatureInfo(gfiConv, bbox, height, width, x, y);

View Full Code Here

            if (layer.getName().equals(layerName)) {
                return layer;
            }
        }

        throw new GeoWebCacheException("Layer " + layerName + " not found, set has "
                + layers.size() + " layers.");
    }
View Full Code Here

    protected BufferedImage loadMatrix(TileLayer layer, String gridSetId, int zoomLevel)
    throws IOException, GeoWebCacheException {
        File fh = new File( createFilePath(gridSetId, zoomLevel) );
       
        if(! fh.exists() || ! fh.canRead()) {
            throw new GeoWebCacheException(fh.getAbsolutePath() + " does not exist or is not readable");
        }
       
        BufferedImage img = ImageIO.read(fh);
       
        int[] widthHeight = calculateWidthHeight(layer.getGridSubset(gridSetId), zoomLevel);
       
        if(img.getWidth() != widthHeight[0] || img.getHeight() != widthHeight[1]) {
            String msg = fh.getAbsolutePath() + " has dimensions " + img.getWidth() + "," + img.getHeight()
            + ", expected " + widthHeight[0] + "," + widthHeight[1];
            throw new GeoWebCacheException(msg);
        }
       
        return img;
    }
View Full Code Here

TOP

Related Classes of org.geowebcache.GeoWebCacheException

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.