Package org.geoserver.wms.map

Examples of org.geoserver.wms.map.RawMap


                }

                LOGGER.finer("No matching ETag, returning cached tile");
                final byte[] mapContents = cachedTile.getContent();
                final String mimeType = cachedTile.getMimeType().getMimeType();
                RawMap map = new RawMap(null, mapContents, mimeType);
                map.setResponseHeader("Cache-Control", "no-cache");
                map.setResponseHeader("ETag", Long.toHexString(cachedTile.getTSCreated()));
                return map;
            }
        }

        return (WebMap) invocation.proceed();
View Full Code Here


    }

    GeoPackage createGeoPackage(WebMap map) throws IOException {
        assertTrue(map instanceof RawMap);

        RawMap rawMap = (RawMap) map;
        File f = File.createTempFile("temp", ".gpkg", new File("target"));
        FileOutputStream fout = new FileOutputStream(f);
        rawMap.writeTo(fout);
        fout.flush();
        fout.close();
       
        return new GeoPackage(f);
//        File f = File.createTempFile("geopkg", "zip", new File("target"));
View Full Code Here

    }
   
    MBTilesFile createMbTilesFiles(WebMap map) throws IOException {
        assertTrue(map instanceof RawMap);

        RawMap rawMap = (RawMap) map;
        File f = File.createTempFile("temp", ".mbtiles", new File("target"));
        FileOutputStream fout = new FileOutputStream(f);
        rawMap.writeTo(fout);
        fout.flush();
        fout.close();
       
        return new MBTilesFile(f);
    }
View Full Code Here

        }

        LOGGER.finer("No matching ETag, returning cached tile");
        final String mimeType = cachedTile.getMimeType().getMimeType();

        RawMap map = new RawMap(null, tileBytes, mimeType);

        map.setContentDispositionHeader(null, "." + cachedTile.getMimeType().getFileExtension(), false);

        Integer cacheAgeMax = getCacheAge(layer);
        LOGGER.log(Level.FINE, "Using cacheAgeMax {0}", cacheAgeMax);
        if (cacheAgeMax != null) {
            map.setResponseHeader("Cache-Control", "max-age=" + cacheAgeMax);
        } else {
            map.setResponseHeader("Cache-Control", "no-cache");
        }

        setConditionalGetHeaders(map, cachedTile, request, etag);
        setCacheMetadataHeaders(map, cachedTile, layer);
View Full Code Here

        tiles.close();

        final File dbFile = tiles.getFile();
        final BufferedInputStream bin = new BufferedInputStream(new FileInputStream(dbFile));

        RawMap result = new RawMap(map, bin, getMimeType()) {
            @Override
            public void writeTo(OutputStream out) throws IOException {
                String dbFilename = getAttachmentFileName();
                if (dbFilename != null) {
                    dbFilename = dbFilename.substring(0, dbFilename.length() - 4) + extension;
                } else {
                    // this shouldn't really ever happen, but fallback anyways
                    dbFilename = "tiles" + extension;
                }

                IOUtils.copy(bin, out);
                out.flush();
                bin.close();
                try {
                    dbFile.delete();
                } catch (Exception e) {
                    LOGGER.log(Level.WARNING, "Error deleting file: " + dbFile.getAbsolutePath(), e);
                }
            }
        };

        result.setContentDispositionHeader(map, extension, true);
        return result;
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wms.map.RawMap

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.