/** * Builds and mangles a URL for a schema contained in GeoServer * * @param baseURL the base URL, containing host, port and application * @param path the path inside the schema location (.../geoserver/schemas/...) */ public static String buildSchemaURL(String baseURL, String path) { return buildURL(baseURL, appendPath(SCHEMAS, path), null, URLType.RESOURCE); }
String result = appendPath(baseURLBuffer.toString(), pathBuffer.toString()); StringBuilder params = new StringBuilder(); for (Map.Entry<String, String> entry : kvpBuffer.entrySet()) {
request.setContextPath("/geoserver"); request.setRequestURI( ResponseUtils.stripQueryString(ResponseUtils.appendPath("/geoserver/", path)));
request.setContextPath("/geoserver"); request.setRequestURI( ResponseUtils.stripQueryString(ResponseUtils.appendPath("/geoserver/", path)));
String buildURI(String base, String path) { if(path != null) { if(path.startsWith(".")) { if(base.endsWith("/")) base = base.substring(1); path = base + path; } else { path = ResponseUtils.appendPath(base, path); } } return ResponseUtils.buildURL(baseURL, path, null, URLType.SERVICE); }
public WFS1_0(WFSInfo wfs, OutputStream output) { super(wfs, output); // set the schema location schemaLocations.put( org.geoserver.wfs.xml.v1_0_0.WFS.NAMESPACE, ResponseUtils.appendPath( wfs.getSchemaBaseURL(), "wfs/1.0.0/WFS-transaction.xsd")); version = "1.0.0"; } }
String buildURI(String base, String path) { if (path != null) { if (path.startsWith(".")) { if (base.endsWith("/")) base = base.substring(1); path = base + path; } else { path = ResponseUtils.appendPath(base, path); } } return ResponseUtils.buildURL(baseURL, path, null, URLMangler.URLType.SERVICE); }
public WFS1_1(WFSInfo wfs, OutputStream output) { super(wfs, output); // add the ows namespace namespaceSupport.declarePrefix("ows", OWS.NAMESPACE); // set the schema location schemaLocations.put( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd")); version = "1.1.0"; } }
@Override public String getSchemaLocation() { String schemaLocation = ResponseUtils.appendQueryString( ResponseUtils.appendPath(baseURL, "wfs"), "request=DescribeFeatureType&service=WFS&version=" + wfs.getVersion()); if (types.isEmpty()) { schemaLocation = ResponseUtils.appendQueryString(schemaLocation, "namespace=" + ns.getURI()); } else { StringBuffer sb = new StringBuffer("typeName="); for (FeatureTypeInfo type : types) { sb.append(type.getPrefixedName()).append(","); } sb.setLength(sb.length() - 1); schemaLocation = ResponseUtils.appendQueryString(schemaLocation, sb.toString()); } return schemaLocation; }
protected String wfsSchemaLocation(WFS wfs, String baseUrl) { return ResponseUtils.appendPath(RequestUtils.proxifiedBaseURL(baseUrl, wfs.getGeoServer().getProxyBaseUrl()), "schemas/wfs/1.0.0/WFS-versioning.xsd"); }
s.append("xsi:schemaLocation=\"http://www.opengis.net/ogc "); s.append( ResponseUtils.appendPath( getInfo().getSchemaBaseURL(), "wfs/1.0.0/OGC-exception.xsd") + "\">\n");
url = new URL( ResponseUtils.appendPath( baseUrl, "styles", wsInfo.getName(), external)); } else { url = new URL(ResponseUtils.appendPath(baseUrl, "styles", external));
reqFileName.substring(0, reqFileName.indexOf('_')).toLowerCase(); if (demoRequestIsHttpGet) { String url = ResponseUtils.appendPath(baseUrl, contents); urlTextField.setModelObject(url); body.setModelObject(""); } else { String serviceUrl = ResponseUtils.appendPath(baseUrl, service); urlTextField.setModelObject(serviceUrl); body.setModelObject(contents);
@Override protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs) throws IOException { hits.setNumberOfFeatures(BigInteger.valueOf(0)); Encoder e = new Encoder(new WFSConfiguration()); e.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset())); e.setSchemaLocation( WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd")); e.encode(hits.getAdaptee(), WFS.FeatureCollection, output); } }
protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs) throws IOException { Encoder encoder = new Encoder(configuration, configuration.schema()); encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset())); encoder.setSchemaLocation( org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd")); encoder.encode( hits.getAdaptee(), org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output); } }
@Override protected void encode(FeatureCollectionResponse hits, OutputStream output, WFSInfo wfs) throws IOException { hits.setNumberOfFeatures(BigInteger.ZERO); // instantiate the XML encoder Encoder encoder = new Encoder(new WFSConfiguration()); encoder.setEncoding(Charset.forName(wfs.getGeoServer().getSettings().getCharset())); encoder.setSchemaLocation( WFS.NAMESPACE, ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/2.0/wfs.xsd")); Document document; try { // encode the HITS result using FeatureCollection as the root XML element document = encoder.encodeAsDOM(hits.getAdaptee(), WFS.FeatureCollection); } catch (Exception exception) { throw new RuntimeException("Error encoding INDEX result.", exception); } // add the resultSetID attribute to the result addResultSetIdElement(document, resultSetId); // write the XML document to response output stream writeDocument(document, output); }
uri = uri.substring(0,question); uri = ResponseUtils.appendPath(uri, location); getResponse().redirectSeeOther(uri);
request.getBaseUrl(), request.getServiceConfig() .getGeoServer().getProxyBaseUrl()); baseUrl = ResponseUtils.appendPath(baseUrl, "wcs");
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); } }
protected static MockHttpServletRequest buildMockRequest() { MockHttpServletRequest request = new MockHttpServletRequest(); request.setScheme("http"); request.setServerName("localhost"); request.setServerPort(8080); request.setContextPath("/geoserver/TestWfsPost"); request.setRequestURI( ResponseUtils.stripQueryString(ResponseUtils.appendPath("/geoserver/TestWfsPost"))); request.setRemoteAddr("127.0.0.1"); return request; } }