I'm using org.apache.http.client.HttpClient and I'm trying to access the payload of the request HTTPEntity without consuming the underlying stream. I tried using
EntityUtils.toString(someEntity);
but this consumes the stream. I just want to preserve the payload which was sent in a HTTP request to a String object for e.g.
Sample Code:
String uri = "someURI";
HttpPut updateRequest = new HttpPut(uri);
updateRequest.setEntity(myHttpEntity);
Any hint appreciated.
A HttpEntity must be
repeatablefor it to be repeatedly consumable. The methodisRepeatable()shows whether or not this is the case.Two entities are repeatable:
This means you have to add one of these to the original request so you can keep using using its content.