Code example for HttpRequestBase

Methods: setURIaddHeader

0
      return body;
    } 
  } 
 
  private <T extends HttpRequestBase> T setupRequest(T request, String resourceName) {
    request.setURI(URI.create(resourceURI(resourceName)));
    request.addHeader("Accept", "application/json");
    request.addHeader("Content-Type", "application/json");
    return request;
  } 
 
  private <T extends HttpEntityEnclosingRequestBase> T setupRequest(T request, String resourceName, String data) throws UnsupportedEncodingException {
    request.setURI(URI.create(resourceURI(resourceName)));
    request.addHeader("Accept", "application/json");
    request.addHeader("Content-Type", "application/json");
    request.setEntity(new StringEntity(data, "UTF-8"));
 
    return request;
  } 
 
  private String doRequest(HttpRequestBase request) throws IOException {