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 ofHttpEntity
that delegates to anRepeatableInputStreamRequestEntity
, 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
Constructors Constructor Description RepeatableInputStreamRequestEntity(HttpExecuteRequest request)
Creates a new RepeatableInputStreamRequestEntity using the information from the specified request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isChunked()
boolean
isRepeatable()
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
-
-
-
-
Constructor Detail
-
RepeatableInputStreamRequestEntity
public RepeatableInputStreamRequestEntity(HttpExecuteRequest request)
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 Detail
-
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
public void writeTo(OutputStream output) throws IOException
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
-
-