Package org.geowebcache.io

Examples of org.geowebcache.io.ByteArrayResource


        }

        /*
         * This thread's byte buffer
         */
        ByteArrayResource buffer = getImageBuffer(WMS_BUFFER);

        try {
            /** ****************** No luck, Request metatile ****** */
            // Leave a hint to save expiration, if necessary
            if (saveExpirationHeaders) {
View Full Code Here


    }

    public ConveyorTile doNonMetatilingRequest(ConveyorTile tile) throws GeoWebCacheException {
        tile.setTileLayer(this);

        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

        // 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

        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

    public String getContentType() {
        return "text/xml";
    }
   
    public Resource getResponse() {
        return new ByteArrayResource(this.toString().getBytes());
    }
View Full Code Here

        if (blankTilePath != null) {
            File fh = new File(blankTilePath);
            if (fh.exists() && fh.canRead() && fh.isFile()) {
                long fileSize = fh.length();
                blankTile = new ByteArrayResource(new byte[(int) fileSize]);
                try {
                    loadBlankTile(blankTile, fh.toURI().toURL());
                } catch (IOException e) {
                    e.printStackTrace();
                }

                if (fileSize == blankTile.getSize()) {
                    log.info("Loaded blank tile from " + blankTilePath);
                } else {
                    log.error("Failed to load blank tile from " + blankTilePath);
                }

                return;
            } else {
                log.error("" + blankTilePath + " does not exist or is not readable.");
            }
        }

        // Use the built-in one:
        try {
            URL url = GeoWebCacheDispatcher.class.getResource("blank.png");
            blankTile = new ByteArrayResource();
            loadBlankTile(blankTile, url);
            int ret = (int) blankTile.getSize();
            log.info("Read " + ret + " from blank PNG file (expected 425).");
        } catch (IOException ioe) {
            log.error(ioe.getMessage());
View Full Code Here

                handleDemoRequest(requestComps[1], request, response);
            } else {
                writeError(response, 404, "Unknown path: " + requestComps[0]);
            }
        } catch (HttpErrorCodeException e) {
            writeFixedResponse(response, e.getErrorCode(), "text/plain", new ByteArrayResource(e
                    .getMessage().getBytes()), CacheResult.OTHER);
        } catch (RequestFilterException e) {

            RequestFilterException reqE = (RequestFilterException) e;
            reqE.setHttpInfoHeader(response);
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

     *             compatibility as there are geoserver builds pegged at a given geoserver revision
     *             but building gwc from trunk. Ok to remove at 1.2.5
     */
    @Deprecated
    public void setContent(byte[] payload) {
        setBlob(new ByteArrayResource(payload));
    }
View Full Code Here

    public GridSubset getGridSubset(String gridSetId) {
        return getGridSubsets().get(gridSetId);
    }

    protected ByteArrayResource getImageBuffer(ThreadLocal<ByteArrayResource> tl) {
        ByteArrayResource buffer = tl.get();
        if (buffer == null) {
            buffer = new ByteArrayResource(16 * 1024);
            tl.set(buffer);
        }
        buffer.truncate();
        return buffer;
    }
View Full Code Here

TOP

Related Classes of org.geowebcache.io.ByteArrayResource

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.