protected static CloseableHttpResponse putResource ( String json , String fullURL ) throws ClientProtocolException , IOException , URISyntaxException { try ( CloseableHttpClient httpclient = HttpClients . createDefault ( ) ) { // There is no need to provide user credentials // HttpClient will attempt to access current user security context // through Windows platform specific methods via JNI. HttpPut httpput = new HttpPut ( new URIBuilder ( fullURL ) . build ( ) ) ; httpput . setHeader ( "Content-Type" , "application/json;charset=UTF-8" ) ; httpput . setEntity ( new StringEntity ( json , "UTF-8" ) ) ; LOG . debug ( "Executing request " + httpput . getRequestLine ( ) ) ; return httpclient . execute ( httpput ) ; } }
Calls a PUT routine with given JSON on given resource URL .