geowebCache 切片不同方式的调用

1.curl 方式

curl -v -u admin:geoserver -H "Content-type: application/json" -d "{'seedRequest':{'name':'NR:tdbp','bounds':{'coords':{ 'double':[ '108.79060363769531','34.31073760986328','109.39276885986328','34.73097610473633']}},'srs':{'number':4326},'zoomStart':1,'zoomStop':12,'format':'image\/png','type':'reseed','threadCount':4}}}" "http://127.0.0.1:8055/geoserver/gwc/rest/seed/NR:tdbp.json"

2.postMan http请求

 3.java 后端调用

public static boolean slice(String layer, int zoomStart, int zoomStop) {
int threadCount = 2;
String res = "";
/*String cmd = "curl -u " + geoUsername + ":" + geoPassword + " -XPOST -H \"Content-type: text/xml\" -d '<seedRequest><name>" + layer +
"</name><srs><number>4326</number></srs><zoomStart>" + zoomStart + "</zoomStart><zoomStop>" + zoomStop + "</zoomStop><format>image/png</format><type>" + layer + "</type><threadCount>" + threadCount + "</threadCount></seedRequest>' \""
+ url + "/gwc/rest/seed/" + layer + ".xml\"";*/
String cmd = "curl -u " + geoUsername + ":" + geoPassword + " -XPOST -H \"Content-type: text/xml\" -d '<seedRequest><name>" + layer +
"</name><srs><number>900913</number></srs><zoomStart>" + zoomStart + "</zoomStart><zoomStop>" + zoomStop + "</zoomStop><format>application/vnd.mapbox-vector-tile</format><type>reseed</type><threadCount>" + threadCount + "</threadCount></seedRequest>' \""
+ url + "/gwc/rest/seed/" + layer + ".xml\"";
HttpResponse curl = curl(cmd);
StatusLine statusLine = curl.getStatusLine();
return "HTTP/1.1 200 ".equals(statusLine.toString());
}

 

 
作者:z-double原文地址:https://www.cnblogs.com/z-double/p/17443483.html

%s 个评论

要回复文章请先登录注册