I am trying to send an HTTP GET with a json object in its body. Is there a way to set the body of an HttpClient HttpGet? I am looking for the equivalent of HttpPost#setEntit
In addition torbinsky's answer, you can add these constructors to the class to make it easier to set the uri:
public HttpGetWithEntity(String uri) throws URISyntaxException{
this.setURI(new URI(uri));
}
public HttpGetWithEntity(URI uri){
this.setURI(uri);
}
The setURI method is inherited from HttpEntityEnclosingRequestBase and can also be used outside the constructor.