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

    Constructors
    Constructor
    Description
    Creates a new RepeatableInputStreamRequestEntity using the information from the specified request.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
    Returns true if the underlying InputStream supports marking/reseting or if the underlying InputStreamRequestEntity is repeatable.
    void
    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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 Details

    • isChunked

      public boolean isChunked()
      Specified by:
      isChunked in interface org.apache.http.HttpEntity
      Overrides:
      isChunked in class org.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 interface org.apache.http.HttpEntity
      Overrides:
      isRepeatable in class org.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 interface org.apache.http.HttpEntity
      Overrides:
      writeTo in class org.apache.http.entity.BasicHttpEntity
      Throws:
      IOException