added reset function
This commit is contained in:
parent
9a811e56b3
commit
76e615a400
@ -65,7 +65,7 @@ public class GeoServerRESTPublisher {
|
|||||||
* @param password password auth credential
|
* @param password password auth credential
|
||||||
*/
|
*/
|
||||||
public GeoServerRESTPublisher(String restURL, String username, String password) {
|
public GeoServerRESTPublisher(String restURL, String username, String password) {
|
||||||
this.restURL = restURL;
|
this.restURL = HTTPUtils.decurtSlash(restURL);
|
||||||
this.gsuser = username;
|
this.gsuser = username;
|
||||||
this.gspass = password;
|
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() {
|
public boolean reload() {
|
||||||
String sUrl = restURL + "/rest/reload";
|
String sUrl = restURL + "/rest/reload";
|
||||||
String result = HTTPUtils.post(sUrl, "", "text/plain", gsuser, gspass);
|
String result = HTTPUtils.post(sUrl, "", "text/plain", gsuser, gspass);
|
||||||
return result != null;
|
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) {
|
public boolean removeLayerGroup(String name) {
|
||||||
try {
|
try {
|
||||||
URL deleteUrl = new URL(restURL + "/rest/layergroups/" + name);
|
URL deleteUrl = new URL(restURL + "/rest/layergroups/" + name);
|
||||||
|
|||||||
@ -427,4 +427,17 @@ 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