Improve on appending the raw parameter on existing query string for publish and update SLDs
This commit is contained in:
parent
213ed8326d
commit
3e810bb869
@ -294,15 +294,15 @@ public class GeoServerRESTStyleManager extends GeoServerRESTAbstractManager {
|
||||
if (sldBody == null || sldBody.isEmpty()) {
|
||||
throw new IllegalArgumentException("The style body may not be null or empty");
|
||||
}
|
||||
|
||||
String sUrl = buildPostUrl(null, name);
|
||||
sUrl += "&raw=" + raw;
|
||||
LOGGER.debug("POSTing new style " + name + " to " + sUrl);
|
||||
|
||||
StringBuilder sUrl = new StringBuilder(buildPostUrl(null, name));
|
||||
Util.appendParameter(sUrl, "raw", ""+raw);
|
||||
String contentType = GeoServerRESTPublisher.Format.SLD.getContentType();
|
||||
if(!this.checkSLD10Version(sldBody)){
|
||||
contentType = GeoServerRESTPublisher.Format.SLD_1_1_0.getContentType();
|
||||
}
|
||||
String result = HTTPUtils.post(sUrl, sldBody, contentType, gsuser, gspass);
|
||||
LOGGER.debug("POSTing new style " + name + " to " + sUrl + " using version: " + contentType);
|
||||
String result = HTTPUtils.post(sUrl.toString(), sldBody, contentType, gsuser, gspass);
|
||||
return result != null;
|
||||
}
|
||||
|
||||
@ -323,14 +323,14 @@ public class GeoServerRESTStyleManager extends GeoServerRESTAbstractManager {
|
||||
* {@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);
|
||||
StringBuilder sUrl = new StringBuilder(buildPostUrl(null, name));
|
||||
Util.appendParameter(sUrl, "raw", ""+raw);
|
||||
String contentType = GeoServerRESTPublisher.Format.SLD.getContentType();
|
||||
if(!this.checkSLD10Version(sldFile)){
|
||||
contentType = GeoServerRESTPublisher.Format.SLD_1_1_0.getContentType();
|
||||
}
|
||||
String result = HTTPUtils.post(sUrl, sldFile, contentType, gsuser, gspass);
|
||||
LOGGER.debug("POSTing new style " + name + " to " + sUrl + " using version: " + contentType);
|
||||
String result = HTTPUtils.post(sUrl.toString(), sldFile, contentType, gsuser, gspass);
|
||||
return result != null;
|
||||
}
|
||||
|
||||
@ -358,14 +358,14 @@ public class GeoServerRESTStyleManager extends GeoServerRESTAbstractManager {
|
||||
throw new IllegalArgumentException("The style name may not be null or empty");
|
||||
}
|
||||
|
||||
String sUrl = buildUrl(null, name, null);
|
||||
sUrl += "?raw=" + raw;
|
||||
LOGGER.debug("POSTing style " + name + " to " + sUrl);
|
||||
StringBuilder sUrl = new StringBuilder(buildUrl(null, name, null));
|
||||
Util.appendParameter(sUrl, "raw", ""+raw);
|
||||
String contentType = GeoServerRESTPublisher.Format.SLD.getContentType();
|
||||
if(!this.checkSLD10Version(sldFile)){
|
||||
contentType = GeoServerRESTPublisher.Format.SLD_1_1_0.getContentType();
|
||||
}
|
||||
String result = HTTPUtils.put(sUrl, sldFile, contentType, gsuser, gspass);
|
||||
LOGGER.debug("PUTting style " + name + " to " + sUrl + " using version: " + contentType);
|
||||
String result = HTTPUtils.put(sUrl.toString(), sldFile, contentType, gsuser, gspass);
|
||||
return result != null;
|
||||
}
|
||||
|
||||
@ -393,14 +393,14 @@ public class GeoServerRESTStyleManager extends GeoServerRESTAbstractManager {
|
||||
throw new IllegalArgumentException("The style name may not be null or empty");
|
||||
}
|
||||
|
||||
String sUrl = buildUrl(null, name, null);
|
||||
sUrl += "&raw=" + raw;
|
||||
LOGGER.debug("POSTing style " + name + " to " + sUrl);
|
||||
StringBuilder sUrl = new StringBuilder(buildUrl(null, name, null));
|
||||
Util.appendParameter(sUrl, "raw", ""+raw);
|
||||
String contentType = GeoServerRESTPublisher.Format.SLD.getContentType();
|
||||
if(!this.checkSLD10Version(sldBody)){
|
||||
contentType = GeoServerRESTPublisher.Format.SLD_1_1_0.getContentType();
|
||||
}
|
||||
String result = HTTPUtils.put(sUrl, sldBody, contentType, gsuser, gspass);
|
||||
LOGGER.debug("PUTting style " + name + " to " + sUrl + " using version: " + contentType);
|
||||
String result = HTTPUtils.put(sUrl.toString(), sldBody, contentType, gsuser, gspass);
|
||||
return result != null;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user