What is the equivalent of httpclient code for the following CURL command
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"
The CURL command works fine. I have limited knowledge of httpclient, however, adapting similar code, following is my attempt:
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); } }
This code above does not compile since I do not know how to encode two urls in the same request as in the CURL command. A fix to the above code or a new approach would be appreciated.
Thanks in advance.