Package com.linecorp.armeria.common
Interface AggregatedHttpResponse
- All Superinterfaces:
AggregatedHttpObject
public interface AggregatedHttpResponse
A complete HTTP response whose content is readily available as a single
HttpData
.-
Method Summary
Modifier and TypeMethodDescriptionheaders()
Returns theResponseHeaders
.Returns the informational class (1xx) HTTP headers.static AggregatedHttpResponse
of
(int statusCode) Creates a new HTTP response.static AggregatedHttpResponse
of
(HttpStatus status) Creates a new HTTP response.static AggregatedHttpResponse
of
(HttpStatus status, MediaType mediaType, byte[] content) Creates a new HTTP response of the specifiedHttpStatus
.static AggregatedHttpResponse
of
(HttpStatus status, MediaType mediaType, HttpData content) Creates a new HTTP response of the specifiedHttpStatus
.static AggregatedHttpResponse
of
(HttpStatus status, MediaType mediaType, HttpData content, HttpHeaders trailers) Creates a new HTTP response of the specifiedHttpStatus
.static AggregatedHttpResponse
of
(HttpStatus status, MediaType mediaType, CharSequence content) Creates a new HTTP response of the specifiedHttpStatus
.static AggregatedHttpResponse
of
(HttpStatus status, MediaType mediaType, String content) Creates a new HTTP response of the specifiedHttpStatus
.static AggregatedHttpResponse
of
(HttpStatus status, MediaType mediaType, String format, Object... args) Creates a new HTTP response of the specifiedHttpStatus
.static AggregatedHttpResponse
of
(ResponseHeaders headers) Creates a new HTTP response with empty content.static AggregatedHttpResponse
of
(ResponseHeaders headers, HttpData content) Creates a new HTTP response.static AggregatedHttpResponse
of
(ResponseHeaders headers, HttpData content, HttpHeaders trailers) Creates a new HTTP response.static AggregatedHttpResponse
of
(Iterable<ResponseHeaders> informationals, ResponseHeaders headers, HttpData content, HttpHeaders trailers) Creates a new HTTP response.status()
Returns the STATUS of this response.default HttpResponse
Converts this response into a new completeHttpResponse
.trailers()
Returns the HTTP trailers.Methods inherited from interface com.linecorp.armeria.common.AggregatedHttpObject
content, content, contentAscii, contentType, contentUtf8
-
Method Details
-
of
Creates a new HTTP response.- Parameters:
statusCode
- the HTTP status code- Throws:
IllegalArgumentException
- if the specifiedstatusCode
is informational.
-
of
Creates a new HTTP response.- Parameters:
status
- the HTTP status- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
Creates a new HTTP response of the specifiedHttpStatus
.- Parameters:
mediaType
- theMediaType
of the response contentcontent
- the content of the response- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
Creates a new HTTP response of the specifiedHttpStatus
.- Parameters:
mediaType
- theMediaType
of the response contentcontent
- the content of the response- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
@FormatMethod static AggregatedHttpResponse of(HttpStatus status, MediaType mediaType, @FormatString String format, Object... args) Creates a new HTTP response of the specifiedHttpStatus
. The content of the response is formatted byString.format(Locale, String, Object...)
with English locale.- Parameters:
mediaType
- theMediaType
of the response contentformat
- the format string of the response contentargs
- the arguments referenced by the format specifiers in the format string- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
Creates a new HTTP response of the specifiedHttpStatus
. Thecontent
will be wrapped usingHttpData.wrap(byte[])
, so any changes made tocontent
will be reflected in the response.- Parameters:
mediaType
- theMediaType
of the response contentcontent
- the content of the response- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
Creates a new HTTP response of the specifiedHttpStatus
.- Parameters:
mediaType
- theMediaType
of the response contentcontent
- the content of the response- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
static AggregatedHttpResponse of(HttpStatus status, MediaType mediaType, HttpData content, HttpHeaders trailers) Creates a new HTTP response of the specifiedHttpStatus
.- Parameters:
mediaType
- theMediaType
of the response contentcontent
- the content of the responsetrailers
- the HTTP trailers- Throws:
IllegalArgumentException
- if the specifiedHttpStatus
is informational.
-
of
Creates a new HTTP response with empty content.- Parameters:
headers
- the HTTP headers- Throws:
IllegalArgumentException
- if the status of the specifiedResponseHeaders
is informational.
-
of
Creates a new HTTP response.- Parameters:
headers
- the HTTP headerscontent
- the content of the HTTP response- Throws:
IllegalArgumentException
- if the status of the specifiedResponseHeaders
is informational.
-
of
Creates a new HTTP response.- Parameters:
headers
- the HTTP headerscontent
- the content of the HTTP responsetrailers
- the HTTP trailers- Throws:
IllegalArgumentException
- if the status of the specifiedResponseHeaders
is informational.
-
of
static AggregatedHttpResponse of(Iterable<ResponseHeaders> informationals, ResponseHeaders headers, HttpData content, HttpHeaders trailers) Creates a new HTTP response.- Parameters:
informationals
- the informational class (1xx) HTTP headersheaders
- the HTTP headerscontent
- the content of the HTTP responsetrailers
- the HTTP trailers- Throws:
IllegalArgumentException
- if the status of the specifiedResponseHeaders
is informational.
-
headers
ResponseHeaders headers()Returns theResponseHeaders
.- Specified by:
headers
in interfaceAggregatedHttpObject
-
informationals
List<ResponseHeaders> informationals()Returns the informational class (1xx) HTTP headers. -
status
HttpStatus status()Returns the STATUS of this response. -
toHttpResponse
Converts this response into a new completeHttpResponse
.- Returns:
- the new
HttpResponse
converted from this response.
-
trailers
HttpHeaders trailers()Returns the HTTP trailers.
-