uk.co.bigbeeconsultants.http.response

UnbufferedResponseBuilder

final class UnbufferedResponseBuilder extends BufferedResponseBuilder

Provides a response builder implementation that returns unbuffered responses along with the InputStream that provides data from the origin HTTP server. This input stream *must* be closed by the calling code to avoid connection leakage issues. The stream implementation makes this easier by automatically closing the stream as soon as all the data has been consumed. This is an alternative to explicitly calling the close() method on the stream; you can use either method.

To make things easier, there are two different cases.

1. For 200 (OK) or 206 (partial content) only, an InputStreamResponseBody is returned, containing the stream ready for use by the calling code, which *must* finally close the stream. As mentioned above, this can either be done by explicitly calling close() or by consuming to the end of the stream, which in this case will automatically close the stream.

2. For all responses other than 200 (OK) or 206 (partial content), a buffered body is returned in which the stream has already been consumed and closed. Calling close() again is harmless but unnecessary.

This is not thread safe so a new instance is required for every request.

See also

InputStreamResponseBody

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. UnbufferedResponseBuilder
  2. BufferedResponseBuilder
  3. ResponseBuilder
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new UnbufferedResponseBuilder()

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def captureResponse(request: Request, status: Status, mediaType: Option[MediaType], headers: Headers, cookies: Option[CookieJar], stream: InputStream, timer: DiagnosticTimer = new DiagnosticTimer): Unit

    Defines the method to be invoked when the response is first received.

    Defines the method to be invoked when the response is first received.

    Definition Classes
    UnbufferedResponseBuilderBufferedResponseBuilderResponseBuilder
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. def networkTimeTaken: Duration

    Gets the time taken from when the request was first sent across the network to when the response was fully received (in the case of a buffered response) or just acquired (in the case of an unbuffered response).

    Gets the time taken from when the request was first sent across the network to when the response was fully received (in the case of a buffered response) or just acquired (in the case of an unbuffered response).

    Definition Classes
    BufferedResponseBuilderResponseBuilder
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. def response: Option[Response]

    Gets the response that was captured earlier.

    Gets the response that was captured earlier.

    Definition Classes
    BufferedResponseBuilderResponseBuilder
  20. def setResponse(response: Response): Unit

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def timer: Option[DiagnosticTimer]

    Gets the timer created before the request was first sent across the network.

    Gets the timer created before the request was first sent across the network.

    Definition Classes
    BufferedResponseBuilderResponseBuilder
  23. def toString(): String

    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  25. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from BufferedResponseBuilder

Inherited from ResponseBuilder

Inherited from AnyRef

Inherited from Any

Ungrouped