public GetMapKvpRequestReader(WMS wms) { super(GetMapRequest.class); this.wms = wms; this.entityResolverProvider = new EntityResolverProvider(wms.getGeoServer()); }
public Charset getCharSet() { GeoServer geoServer2 = getGeoServer(); String charset = geoServer2.getSettings().getCharset(); return Charset.forName(charset); }
private JAIInfo getJaiInfo() { GeoServer geoServer = getGeoServer(); GeoServerInfo global = geoServer.getGlobal(); return global.getJAI(); }
@Override public String getCharset() { return wms.getGeoServer().getSettings().getCharset(); } }
public String getProxyBaseUrl() { GeoServer geoServer = getGeoServer(); return geoServer.getSettings().getProxyBaseUrl(); }
@Override public String getCharset() { return wms.getGeoServer().getSettings().getCharset(); } }
@Override public String getCharset(Operation operation) { return wms.getGeoServer().getSettings().getCharset(); } }
@Override public String getCharset() { return wms.getGeoServer().getSettings().getCharset(); } }
private void writeJSONP(OutputStream out, DescribeLayerModel layers) throws IOException { // prepare to write out OutputStreamWriter osw = null; Writer outWriter = null; try { osw = new OutputStreamWriter(out, wms.getGeoServer().getSettings().getCharset()); outWriter = new BufferedWriter(osw); outWriter.write(getCallbackFunction() + "("); writeJSON(outWriter, layers); outWriter.write(")"); outWriter.flush(); } finally { IOUtils.closeQuietly(outWriter); IOUtils.closeQuietly(osw); } }
public long getUpdateSequence() { GeoServerInfo global = getGeoServer().getGlobal(); return global.getUpdateSequence(); }
public int getNumDecimals() { return getGeoServer().getSettings().getNumDecimals(); }
/** Actually write the passed DescribeLayerModel on the OutputStream */ public void write(DescribeLayerModel layers, DescribeLayerRequest request, OutputStream output) throws ServiceException, IOException { switch (type) { case JSON: OutputStreamWriter osw = null; Writer outWriter = null; try { osw = new OutputStreamWriter( output, wms.getGeoServer().getSettings().getCharset()); outWriter = new BufferedWriter(osw); writeJSON(outWriter, layers); } finally { IOUtils.closeQuietly(outWriter); IOUtils.closeQuietly(osw); } case JSONP: writeJSONP(output, layers); } }
/** * Writes a Json (or Jsonp) response on the passed output stream * * @see {@link GetFeatureInfoOutputFormat#write(FeatureCollectionType, GetFeatureInfoRequest, * OutputStream)} */ @Override public void write( FeatureCollectionType features, GetFeatureInfoRequest fInfoReq, OutputStream out) throws IOException { GeoJSONGetFeatureResponse format = new GeoJSONGetFeatureResponse(wms.getGeoServer(), getContentType()); format.write(features, out, null); }
public void setSvgRenderer(String svgRendererHint) { WMSInfo serviceInfo = getServiceInfo(); serviceInfo.getMetadata().put("svgRenderer", svgRendererHint); getGeoServer().save(serviceInfo); }
/** * Takes the <code>FeatureResult</code>s generated by the <code>execute</code> method in the * superclass and constructs a <code>DescribeLayerResult</code> which is passed to a <code> * GML2FeatureResponseDelegate</code>. * * @see AbstractFeatureInfoResponse#writeTo(OutputStream) */ @Override public void write(DescribeLayerModel results, DescribeLayerRequest request, OutputStream out) throws ServiceException, IOException { DescribeLayerTransformer transformer; transformer = new DescribeLayerTransformer(request.getBaseUrl()); Charset encoding = wms.getCharSet(); transformer.setEncoding(encoding); if (wms.getGeoServer().getSettings().isVerbose()) { transformer.setIndentation(2); } try { transformer.transform(request, out); out.flush(); } catch (TransformerException e) { throw new ServiceException(e); } } }
public void testSldDisabled() throws Exception { HashMap kvp = new HashMap(); URL url = GetMapKvpRequestReader.class.getResource("BasicPolygonsLibraryDefault.sld"); String decoded = URLDecoder.decode(url.toExternalForm(), "UTF-8"); kvp.put("sld", decoded); kvp.put( "layers", MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart()); WMS wms = new WMS(getGeoServer()); WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class); WMSInfo info = new WMSInfoImpl(); info.setDynamicStylingDisabled(Boolean.TRUE); getGeoServer().remove(oldInfo); getGeoServer().add(info); reader = new GetMapKvpRequestReader(wms); GetMapRequest request = (GetMapRequest) reader.createRequest(); boolean error = false; try { request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp); } catch (ServiceException e) { error = true; } getGeoServer().remove(info); getGeoServer().add(oldInfo); assertTrue(error); }
protected String getFeatureTypeURL(KmlEncodingContext context) throws IOException { GeoServer gs = context.getWms().getGeoServer(); Catalog catalog = gs.getCatalog(); Layer layer = context.getCurrentLayer(); FeatureSource featureSource = layer.getFeatureSource(); Name typeName = featureSource.getSchema().getName(); String nsUri = typeName.getNamespaceURI(); NamespaceInfo ns = catalog.getNamespaceByURI(nsUri); String featureTypeName = typeName.getLocalPart(); GetMapRequest request = context.getRequest(); String baseURL = request.getBaseUrl(); String prefix = ns.getPrefix(); return buildURL(baseURL, appendPath("rest", prefix, featureTypeName), null, URLType.SERVICE); } }
public void testSldBodyDisabled() throws Exception { HashMap kvp = new HashMap(); kvp.put("sld_body", STATES_SLD); kvp.put( "layers", MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart()); WMS wms = new WMS(getGeoServer()); WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class); WMSInfo info = new WMSInfoImpl(); info.setDynamicStylingDisabled(Boolean.TRUE); getGeoServer().remove(oldInfo); getGeoServer().add(info); reader = new GetMapKvpRequestReader(wms); GetMapRequest request = (GetMapRequest) reader.createRequest(); boolean error = false; try { request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp); } catch (ServiceException e) { error = true; } getGeoServer().remove(info); getGeoServer().add(oldInfo); assertTrue(error); }
public void testSldBodyDisabled() throws Exception { HashMap kvp = new HashMap(); kvp.put("sld_body", STATES_SLD); kvp.put( "layers", MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart()); WMS wms = new WMS(getGeoServer()); WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class); WMSInfo info = new WMSInfoImpl(); info.setDynamicStylingDisabled(Boolean.TRUE); getGeoServer().remove(oldInfo); getGeoServer().add(info); reader = new GetFeatureInfoKvpReader(wms); GetFeatureInfoRequest request = (GetFeatureInfoRequest) reader.createRequest(); boolean error = false; try { request = (GetFeatureInfoRequest) reader.read(request, parseKvp(kvp), kvp); } catch (ServiceException e) { error = true; } getGeoServer().remove(info); getGeoServer().add(oldInfo); assertTrue(error); } }
public void testAllowDynamicStyles() throws Exception { GetMapRequest request = (GetMapRequest) reader.createRequest(); BufferedReader input = getResourceInputStream("WMSPostLayerGroupNonDefaultStyle.xml"); WMS wms = new WMS(getGeoServer()); WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class); WMSInfo info = new WMSInfoImpl(); info.setDynamicStylingDisabled(Boolean.TRUE); getGeoServer().remove(oldInfo); getGeoServer().add(info); GetMapXmlReader reader = new GetMapXmlReader(wms); boolean error = false; try { request = (GetMapRequest) reader.read(request, input, new HashMap()); } catch (ServiceException e) { error = true; } getGeoServer().remove(info); getGeoServer().add(oldInfo); assertTrue(error); }