Using raw format to publish correctly an SLD file v. 1.1.0 via REST API
This commit is contained in:
andypower 2015-03-20 17:42:20 +01:00
parent 3e580b73d1
commit fd84472576

View File

@ -259,6 +259,20 @@ public class GeoServerRESTStyleManager extends GeoServerRESTAbstractManager {
String result = HTTPUtils.post(sUrl, sldFile, GeoServerRESTPublisher.Format.SLD.getContentType(), gsuser, gspass);
return result != null;
}
public boolean publishStyle(final File sldFile, final String name, final boolean raw) {
/*
* This is the equivalent call with cUrl:
*
* {@code curl -u admin:geoserver -XPOST \ -H 'Content-type: application/vnd.ogc.sld+xml' \ -d @$FULLSLD \
* http://$GSIP:$GSPORT/$SERVLET/rest/styles?name=name&raw=raw}
*/
String sUrl = buildPostUrl(null, name);
sUrl += "&raw=" + raw;
LOGGER.debug("POSTing new style " + name + " to " + sUrl);
String result = HTTPUtils.post(sUrl, sldFile, GeoServerRESTPublisher.Format.SLD.getContentType(), gsuser, gspass);
return result != null;
}
/**
* Update a Style.