Что эквивалентно коду httpclient для следующей команды CURL
curl -v -u username:password-XPUT -H "Content-type: text/plain" -d "E:/path_to_shapefile/shapefiles/" "http://172.16.17.86:9090/geoserver/rest/workspaces/IDIRA6/datastores/scenario2373/external.shp?configure=all"
Команда CURL работает нормально. У меня ограниченные знания httpclient, однако, при адаптации подобного кода моя попытка заключается в следующем:
import org.apache.http.client.fluent.*;
public class QuickStart {
public static void main(String[] args) throws Exception {
Executor executor = Executor.newInstance()
.auth("username", "password")
.authPreemptive("172.16.17.86:9090");
// Line below does not compile
String response = executor.execute(Request.Put("E:/path_to_shapefile/shapefiles/"
"http://172.16.17.86:9090/geoserver/rest/workspaces/IDIRA6/datastores/scenario2373/external.shp?configure=all"))
.returnResponse()
.toString();
System.out.println(response);
}
}
Этот код выше не компилируется, так как я не знаю, как кодировать два URL в одном запросе, как в команде CURL. Будет приветствоваться исправление вышеуказанного кода или новый подход.
Заранее спасибо.