Class RepeatableInputStreamRequestEntity
java.lang.Object
org.apache.http.entity.AbstractHttpEntity
org.apache.http.entity.BasicHttpEntity
software.amazon.awssdk.http.apache.internal.RepeatableInputStreamRequestEntity
- All Implemented Interfaces:
org.apache.http.HttpEntity
public class RepeatableInputStreamRequestEntity
extends org.apache.http.entity.BasicHttpEntity
Custom implementation of
HttpEntity
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.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new RepeatableInputStreamRequestEntity using the information from the specified request. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Returns true if the underlying InputStream supports marking/reseting or if the underlying InputStreamRequestEntity is repeatable.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.Methods inherited from class org.apache.http.entity.BasicHttpEntity
getContent, getContentLength, isStreaming, setContent, setContentLength
Methods inherited from class org.apache.http.entity.AbstractHttpEntity
consumeContent, getContentEncoding, getContentType, setChunked, setContentEncoding, setContentEncoding, setContentType, setContentType, toString
-
Constructor Details
-
RepeatableInputStreamRequestEntity
Creates a new RepeatableInputStreamRequestEntity using the information from the specified request. If the input stream containing the request's contents is repeatable, then this RequestEntity will report as being repeatable.- Parameters:
request
- The details of the request being written out (content type, content length, and content).
-
-
Method Details
-
isChunked
public boolean isChunked()- Specified by:
isChunked
in interfaceorg.apache.http.HttpEntity
- Overrides:
isChunked
in classorg.apache.http.entity.AbstractHttpEntity
-
isRepeatable
public boolean isRepeatable()Returns true if the underlying InputStream supports marking/reseting or if the underlying InputStreamRequestEntity is repeatable.- Specified by:
isRepeatable
in interfaceorg.apache.http.HttpEntity
- Overrides:
isRepeatable
in classorg.apache.http.entity.BasicHttpEntity
-
writeTo
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.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.
- Specified by:
writeTo
in interfaceorg.apache.http.HttpEntity
- Overrides:
writeTo
in classorg.apache.http.entity.BasicHttpEntity
- Throws:
IOException
-