Code example for HttpPut

Methods: setEntityaddHeader

0
  public RestResponse put(String endPoint) throws IOException {
    return put(endPoint, null);
  } 
 
  public RestResponse put(String endPoint, Object content) throws IOException {
    HttpPut put = new HttpPut("http://localhost:8080/a" + endPoint);
    if (content != null) {
      put.addHeader(new BasicHeader("Content-Type", "application/json"));
      put.setEntity(new StringEntity((new Gson()).toJson(content), HTTP.UTF_8));
    } 
    return new RestResponse(getClient().execute(put));
  } 
 
  public RestResponse post(String endPoint) {
    // TODO 
    return null; 
  } 
 
  public RestResponse delete(String endPoint) throws IOException {
    HttpDelete delete = new HttpDelete("http://localhost:8080/a" + endPoint);
    return new RestResponse(getClient().execute(delete));