Class StreamedResponse

java.lang.Object
org.attribyte.api.http.Response
org.attribyte.api.http.StreamedResponse

public class StreamedResponse extends Response
A response that allows the body to be streamed.
  • Field Details

    • body

      public final com.google.common.io.ByteSource body
      The source for the body.
  • Constructor Details

    • StreamedResponse

      public StreamedResponse(int statusCode, Map<?,?> headers, com.google.common.io.ByteSource body, Map<String,Object> attributes, Stats stats, Collection<Cookie> cookies)
      Creates a response.
      Parameters:
      statusCode - The HTTP response status code.
      headers - The response headers.
      body - The response body source.
      attributes - The attributes.
      stats - The stats.
      cookies - The cookies.
  • Method Details

    • getBody

      public com.google.protobuf.ByteString getBody() throws IOException
      Description copied from class: Response
      Gets the response body as an immutable ByteString.
      Overrides:
      getBody in class Response
      Returns:
      The response body, or null if none.
      Throws:
      IOException - if the body is streamed and an input error occurs.
    • getBodySource

      public com.google.common.io.ByteSource getBodySource()
      Gets a source for the body.
      Returns:
      The body, or null if none.