Package org.geowebcache.io

Examples of org.geowebcache.io.Resource


        } 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);

        try {
            tile.servletResp.setContentType(mimeType.getMimeType());
            ServletOutputStream outputStream = tile.servletResp.getOutputStream();
            data.transferTo(Channels.newChannel(outputStream));
            outputStream.flush();
        } catch (IOException ioe) {
            tile.servletResp.setStatus(500);
            log.error(ioe.getMessage());
        }
View Full Code Here


        // Should we do mime type checks?

        // note: not using getImageBuffer() here cause this method is not called during seeding, so
        // there's no gain
        Resource buffer = new ByteArrayResource(2048);
        sourceHelper.makeRequest(tile, buffer);
        tile.setBlob(buffer);

        return tile;
    }
View Full Code Here

        String path = getTilePath(tile);
        File tileFile = new File(path);

        if (tileFile.exists()) {
            Resource tileContent = readFile(tileFile);
            tile.setCacheResult(CacheResult.HIT);
            tile.setBlob(tileContent);
        } else {
            tile.setCacheResult(CacheResult.MISS);
            if (!setLayerBlankTile(tile)) {
View Full Code Here

    private boolean setLayerBlankTile(ConveyorTile tile) {
        // TODO cache result
        String layerPath = getLayerPath().append(File.separatorChar).toString();
        File png = new File(layerPath + "blank.png");
        Resource blank = null;
        try {
            if (png.exists()) {
                blank = readFile(png);
                tile.setBlob(blank);
                tile.setMimeType(MimeType.createFromFormat("image/png"));
View Full Code Here

    private Resource readFile(File fh) throws StorageException {
        if (!fh.exists()) {
            return null;
        }
        Resource res = new FileResource(fh);
        return res;
    }
View Full Code Here

        wmsParams.put("X", String.valueOf(x));
        wmsParams.put("Y", String.valueOf(y));

        String mimeType = tile.getMimeType().getMimeType();
        Resource target = new ByteArrayResource(2048);
        makeRequest(tile, layer, wmsParams, mimeType, target);
        return target;
    }
View Full Code Here

                + ServletUtils.disableHTMLTags(errorMsg) + "</h4>" + "</body></html>\n";
        writePage(response, httpCode, errorMsg);
    }

    private void writePage(HttpServletResponse response, int httpCode, String message) {
        Resource res = new ByteArrayResource(message.getBytes());
        writeFixedResponse(response, httpCode, "text/html", res, CacheResult.OTHER);
    }
View Full Code Here

     *             there are geoserver builds pegged at a given geoserver revision but building gwc
     *             from trunk. Ok to remove at 1.2.5
     */
    @Deprecated
    public byte[] getContent() {
        Resource blob = getBlob();
        if (blob instanceof ByteArrayResource) {
            return ((ByteArrayResource) blob).getContents();
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream((int) blob.getSize());
        try {
            blob.transferTo(Channels.newChannel(out));
            return out.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            throw new StorageException(
                    "metaStore.get() returned true, but did not set an id on the object");
        }
       
        if(tileObj.blob_size > 0) {
            Resource blob = blobStore.get(tileObj);
            if(blob == null) {
                throw new StorageException(
                        "Blob for "+Arrays.toString(tileObj.xyz)+" was expected to have size "
                        + tileObj.blob_size + " but was null.");
            } else if(verifyFileSize && blob.getSize() != tileObj.blob_size) {
                throw new StorageException(
                        "Blob was expected to have size "
                        + tileObj.blob_size + " but was " + blob.getSize());
            }
               
            tileObj.blob = blob;
            return true;
        }
View Full Code Here

    }
   
    private boolean getBlobOnly(TileObject tileObj) throws StorageException {
        if(tileObj.getParameters() == null
                || tileObj.getParameters().size() == 0) {
            Resource blob = blobStore.get(tileObj);
            if(blob == null) {
                return false;
            } else {
                tileObj.blob = blob;
                return true;
View Full Code Here

TOP

Related Classes of org.geowebcache.io.Resource

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.