From 6b77579ec081025ce8b199ade8245a32b14f7bc0 Mon Sep 17 00:00:00 2001 From: Carl Schroedl Date: Tue, 20 Sep 2016 14:32:07 -0500 Subject: [PATCH] Cleanup #199 --- .../geoserver/rest/GeoServerRESTPublisher.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java b/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java index 9223844..73e58a6 100644 --- a/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java +++ b/src/main/java/it/geosolutions/geoserver/rest/GeoServerRESTPublisher.java @@ -3261,6 +3261,7 @@ public class GeoServerRESTPublisher { * @param storeName * @param layerName * @param calculationMode + * @param enabled * @return true if recalculation succeeded, false otherwise. */ private boolean recalculateBBox(StoreType type, String xmlElementName, String workspace, String storeName, String layerName, BBoxRecalculationMode calculationMode, boolean enabled){ @@ -3269,22 +3270,18 @@ public class GeoServerRESTPublisher { type.getType().toLowerCase() +"s/" + storeName + "/" + type.getTypeName().toLowerCase() + "/" + layerName + "." + Format.XML.toString(); - - -// LOGGER.debug("Retrieving current state of item from "+ baseUrl); -// String getResult = HTTPUtils.get(baseUrl, gsuser, gspass); - -// LOGGER.debug("Current state of item is:\n" + getResult); String sUrl = baseUrl + "?recalculate=" + calculationMode.getParamValue(); LOGGER.debug("Constructed the following url for bounding box recalculation: " + sUrl); - -// String body = getResult -// GSWorkspaceEncoder wsenc = new GSWorkspaceEncoder(workspace); -// String body = wsenc.toString(); + /* + * If the 'enabled' element is not specified in the request body, it will be set to 'false' by GeoServer. + * To avoid unintentional disabling of layers, this method and its callers + * require that users specify whether the layer should be enabled. + */ String body = "<" + xmlElementName +">" + layerName + "" + "" + enabled + ""; + String sendResult = HTTPUtils.putXml(sUrl, body, gsuser, gspass); boolean success = sendResult != null; return success;