Package org.attribyte.api.http
Class StreamedResponse
java.lang.Object
org.attribyte.api.http.Response
org.attribyte.api.http.StreamedResponse
A response that allows the body to be streamed.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.attribyte.api.http.Response
Response.Code -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.google.common.io.ByteSourceThe source for the body.Fields inherited from class org.attribyte.api.http.Response
attributes, cookies, headers, stats, statusCode -
Constructor Summary
ConstructorsConstructorDescriptionStreamedResponse(int statusCode, Map<?, ?> headers, com.google.common.io.ByteSource body, Map<String, Object> attributes, Stats stats, Collection<Cookie> cookies) Creates a response. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.protobuf.ByteStringgetBody()Gets the response body as an immutableByteString.com.google.common.io.ByteSourceGets a source for the body.Methods inherited from class org.attribyte.api.http.Response
getAttribute, getAttribute, getCharset, getContentType, getHeaders, getHeaderValue, getHeaderValueList, getHeaderValues, getStats, getStatusCode, getTiming, toString
-
Field Details
-
body
public final com.google.common.io.ByteSource bodyThe 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
Description copied from class:ResponseGets the response body as an immutableByteString.- Overrides:
getBodyin classResponse- Returns:
- The response body, or
nullif 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
nullif none.
-