@Override public RawMap build(WMSMapContent mapContent) throws IOException { byte[] contents = encoder.encode(); return new RawMap(mapContent, contents, MIME_TYPE); }
private void setCacheMetadataHeaders(RawMap map, ConveyorTile cachedTile, TileLayer layer) { long[] tileIndex = cachedTile.getTileIndex(); CacheResult cacheResult = cachedTile.getCacheResult(); GridSubset gridSubset = layer.getGridSubset(cachedTile.getGridSetId()); BoundingBox tileBounds = gridSubset.boundsFromIndex(tileIndex); String cacheResultHeader = cacheResult == null ? "UNKNOWN" : cacheResult.toString(); map.setResponseHeader("geowebcache-layer", layer.getName()); map.setResponseHeader("geowebcache-cache-result", cacheResultHeader); map.setResponseHeader("geowebcache-tile-index", Arrays.toString(tileIndex)); map.setResponseHeader("geowebcache-tile-bounds", tileBounds.toString()); map.setResponseHeader("geowebcache-gridset", gridSubset.getName()); map.setResponseHeader("geowebcache-crs", gridSubset.getSRS().toString()); }
@Override public RawMap build(WMSMapContent mapContent) throws IOException { jsonWriter.endArray(); // end features jsonWriter.endObject();// end root object writer.flush(); writer.close(); out.close(); long length; RawMap map; if (out.isInMemory()) { byte[] data = out.getData(); length = data.length; map = new RawMap(mapContent, data, MIME_TYPE); } else { File f = out.getFile(); length = f.length(); map = new DeferredFileOutputStreamWebMap(mapContent, out, MIME_TYPE); } map.setResponseHeader("Content-Length", String.valueOf(length)); return map; } }
final String mimeType = cachedTile.getMimeType().getMimeType(); RawMap map = new RawMap(null, tileBytes, mimeType); map.setContentDispositionHeader(null, "." + cachedTile.getMimeType().getFileExtension(), false); map.setResponseHeader("Cache-Control", "max-age=" + cacheAgeMax); } else { map.setResponseHeader("Cache-Control", "no-cache");
private String decode(RawMap map) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); String out = new String(bos.toByteArray(), "UTF-8"); return out; } }
@Test public void testInputStream() throws Exception { InputStream stream = createMock(InputStream.class); expect(stream.read((byte[]) anyObject())).andReturn(-1).once(); replay(stream); WMSMapContent map = createNiceMock(WMSMapContent.class); replay(map); new RawMap(map, stream, "text/plain").writeTo(null); verify(stream); } }
public RawMap( final WMSMapContent mapContent, final ByteArrayOutputStream buff, final String mimeType) { super(mapContent); this.buffer = buff; setMimeType(mimeType); }
@Override public RawMap build(WMSMapContent mapContent) throws IOException { jsonWriter.endArray(); // end features jsonWriter.endObject(); // end root object writer.flush(); writer.close(); out.close(); long length; RawMap map; if (out.isInMemory()) { byte[] data = out.getData(); length = data.length; map = new RawMap(mapContent, data, MIME_TYPE); } else { File f = out.getFile(); length = f.length(); map = new DeferredFileOutputStreamWebMap(mapContent, out, MIME_TYPE); } map.setResponseHeader("Content-Length", String.valueOf(length)); return map; } }
final String mimeType = cachedTile.getMimeType().getMimeType(); RawMap map = new RawMap(null, tileBytes, mimeType); map.setContentDispositionHeader( null, "." + cachedTile.getMimeType().getFileExtension(), false); 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");
private String decode(RawMap map) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); String out = new String(bos.toByteArray(), "UTF-8"); return out; }
public RawMap(final WMSMapContent mapContent, final byte[] mapContents, final String mimeType) { super(mapContent); this.mapContents = mapContents; setMimeType(mimeType); }
byte[] data = out.getData(); length = data.length; map = new RawMap(mapContent, data, MIME_TYPE); } else { File f = out.getFile(); map = new DeferredFileOutputStreamWebMap(mapContent, out, MIME_TYPE); map.setResponseHeader("Content-Length", String.valueOf(length));
String getAsHTMLOL3(WMSMapContent map) throws IOException { OpenLayers3MapOutputFormat mapProducer = GeoServerExtensions.extensions(OpenLayers3MapOutputFormat.class).get(0); RawMap rawMap = mapProducer.produceMap(map); ByteArrayOutputStream bos = new ByteArrayOutputStream(); rawMap.writeTo(bos); return new String(bos.toByteArray(), "UTF-8"); }
@Override public RawMap build(WMSMapContent mapContent) throws IOException { byte[] contents = encoder.encode(); return new RawMap(mapContent, contents, MIME_TYPE); } }
private void setCacheMetadataHeaders(RawMap map, ConveyorTile cachedTile, TileLayer layer) { long[] tileIndex = cachedTile.getTileIndex(); CacheResult cacheResult = cachedTile.getCacheResult(); GridSubset gridSubset = layer.getGridSubset(cachedTile.getGridSetId()); BoundingBox tileBounds = gridSubset.boundsFromIndex(tileIndex); String cacheResultHeader = cacheResult == null ? "UNKNOWN" : cacheResult.toString(); map.setResponseHeader("geowebcache-layer", layer.getName()); map.setResponseHeader("geowebcache-cache-result", cacheResultHeader); map.setResponseHeader("geowebcache-tile-index", Arrays.toString(tileIndex)); map.setResponseHeader("geowebcache-tile-bounds", tileBounds.toString()); map.setResponseHeader("geowebcache-gridset", gridSubset.getName()); map.setResponseHeader("geowebcache-crs", gridSubset.getSRS().toString()); }
public RawMap(final WMSMapContent mapContent, final InputStream stream, final String mimeType) { super(mapContent); this.stream = stream; setMimeType(mimeType); }
byte[] data = out.getData(); length = data.length; map = new RawMap(mapContent, data, MIME_TYPE); } else { File f = out.getFile(); map = new DeferredFileOutputStreamWebMap(mapContent, out, MIME_TYPE); map.setResponseHeader("Content-Length", String.valueOf(length));
String getAsHTML(WMSMapContent map) throws IOException { OpenLayersMapOutputFormat mapProducer = GeoServerExtensions.extensions(OpenLayersMapOutputFormat.class).get(0); RawMap rawMap = mapProducer.produceMap(map); ByteArrayOutputStream bos = new ByteArrayOutputStream(); rawMap.writeTo(bos); return new String(bos.toByteArray(), "UTF-8"); }
ByteArrayOutputStream buff = new ByteArrayOutputStream(); template.process(map, new OutputStreamWriter(buff, Charset.forName("UTF-8"))); RawMap result = new RawMap(mapContent, buff, getMimeType()); return result; } catch (TemplateException e) {