public class RepeatableInputStreamRequestEntity
extends org.apache.http.entity.BasicHttpEntity
RequestEntity
that delegates to an
RepeatableInputStreamRequestEntity
, with the one notable difference, that if
the underlying InputStream supports being reset, this RequestEntity will
report that it is repeatable and will reset the stream on all subsequent
attempts to write out the request.
TODO : Move this to apache specific package.Constructor and Description |
---|
RepeatableInputStreamRequestEntity(Request<?> request)
Creates a new RepeatableInputStreamRequestEntity using the information
from the specified request.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isChunked() |
boolean |
isRepeatable()
Returns true if the underlying InputStream supports marking/reseting or
if the underlying InputStreamRequestEntity is repeatable (i.e.
|
void |
writeTo(OutputStream output)
Resets the underlying InputStream if this isn't the first attempt to
write out the request, otherwise simply delegates to
InputStreamRequestEntity to write out the data.
|
getContent, getContentLength, isStreaming, setContent, setContentLength
public RepeatableInputStreamRequestEntity(Request<?> request)
request
- The details of the request being written out (content type,
content length, and content).public boolean isChunked()
isChunked
in interface org.apache.http.HttpEntity
isChunked
in class org.apache.http.entity.AbstractHttpEntity
public boolean isRepeatable()
InputStreamRequestEntity#CONTENT_LENGTH_AUTO
and therefore its
entire contents will be buffered in memory and can be repeated).isRepeatable
in interface org.apache.http.HttpEntity
isRepeatable
in class org.apache.http.entity.BasicHttpEntity
org.apache.commons.httpclient.methods.RequestEntity#isRepeatable()
public void writeTo(OutputStream output) throws IOException
If an error is encountered the first time we try to write the request entity, we remember the original exception, and report that as the root cause if we continue to encounter errors, rather than masking the original error.
writeTo
in interface org.apache.http.HttpEntity
writeTo
in class org.apache.http.entity.BasicHttpEntity
IOException
org.apache.commons.httpclient.methods.RequestEntity#writeRequest(java.io.OutputStream)