added reset function
This commit is contained in:
parent
882475be5c
commit
7369cfd82a
@ -65,7 +65,7 @@ public class GeoServerRESTPublisher {
|
||||
* @param password password auth credential
|
||||
*/
|
||||
public GeoServerRESTPublisher(String restURL, String username, String password) {
|
||||
this.restURL = restURL;
|
||||
this.restURL = HTTPUtils.decurtSlash(restURL);
|
||||
this.gsuser = username;
|
||||
this.gspass = password;
|
||||
}
|
||||
@ -680,12 +680,30 @@ public class GeoServerRESTPublisher {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reload the target geoserver configuration
|
||||
* @return true if success
|
||||
*
|
||||
* @see http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html
|
||||
*/
|
||||
public boolean reload() {
|
||||
String sUrl = restURL + "/rest/reload";
|
||||
String result = HTTPUtils.post(sUrl, "", "text/plain", gsuser, gspass);
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset the target geoserver configuration
|
||||
* @return true if success
|
||||
*
|
||||
* @see http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html
|
||||
*/
|
||||
public boolean reset() {
|
||||
String sUrl = restURL + "/rest/reset";
|
||||
String result = HTTPUtils.post(sUrl, "", "text/plain", gsuser, gspass);
|
||||
return result != null;
|
||||
}
|
||||
|
||||
public boolean removeLayerGroup(String name) {
|
||||
try {
|
||||
URL deleteUrl = new URL(restURL + "/rest/layergroups/" + name);
|
||||
|
||||
@ -426,5 +426,18 @@ class HTTPUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* recursively remove ending slashes
|
||||
*
|
||||
* @param geoserverURL
|
||||
* @return
|
||||
*/
|
||||
public static String decurtSlash(String geoserverURL) {
|
||||
if (geoserverURL.endsWith("/")) {
|
||||
geoserverURL = decurtSlash(geoserverURL.substring(0, geoserverURL.length() - 1));
|
||||
}
|
||||
return geoserverURL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
package it.geosolutions.geoserver.rest.encoder;
|
||||
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder.ProjectionPolicy;
|
||||
import it.geosolutions.geoserver.rest.encoder.coverage.GSCoverageEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.metadata.GSDimensionInfoEncoder;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class GSResourceEncoderTest {
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user