Package com.linecorp.armeria.common
Interface AggregatedHttpRequest
-
public interface AggregatedHttpRequest
A complete HTTP request whose content is readily available as a singleHttpData
.
-
-
Method Summary
Modifier and Type Method Description String
authority()
Returns the AUTHORITY of this request, in the form of"hostname:port"
.HttpData
content()
Returns the content of this message.default String
content(Charset charset)
Returns the content of this message as a string encoded in the specifiedCharset
.default String
contentAscii()
Returns the content of this message as an ASCII string.default MediaType
contentType()
Returns the value of the'content-type'
header.default String
contentUtf8()
Returns the content of this message as a UTF-8 string.RequestHeaders
headers()
Returns theRequestHeaders
.HttpMethod
method()
Returns the METHOD of this request.static AggregatedHttpRequest
of(HttpMethod method, String path)
Creates a new HTTP request with empty content.static AggregatedHttpRequest
of(HttpMethod method, String path, MediaType mediaType, byte[] content)
Creates a new HTTP request.static AggregatedHttpRequest
of(HttpMethod method, String path, MediaType mediaType, HttpData content)
Creates a new HTTP request.static AggregatedHttpRequest
of(HttpMethod method, String path, MediaType mediaType, HttpData content, HttpHeaders trailers)
Creates a new HTTP request.static AggregatedHttpRequest
of(HttpMethod method, String path, MediaType mediaType, CharSequence content)
Creates a new HTTP request.static AggregatedHttpRequest
of(HttpMethod method, String path, MediaType mediaType, String content)
Creates a new HTTP request.static AggregatedHttpRequest
of(HttpMethod method, String path, MediaType mediaType, String format, Object... args)
Creates a new HTTP request.static AggregatedHttpRequest
of(RequestHeaders headers)
Creates a new HTTP request with empty content.static AggregatedHttpRequest
of(RequestHeaders headers, HttpData content)
Creates a new HTTP request.static AggregatedHttpRequest
of(RequestHeaders headers, HttpData content, HttpHeaders trailers)
Creates a new HTTP request.String
path()
Returns the PATH of this request.String
scheme()
Returns the SCHEME of this request.default HttpRequest
toHttpRequest()
Converts this request into a new completeHttpRequest
.HttpHeaders
trailers()
Returns the HTTP trailers.default HttpHeaders
trailingHeaders()
Deprecated.Usetrailers()
.
-
-
-
Method Detail
-
of
static AggregatedHttpRequest of(HttpMethod method, String path)
Creates a new HTTP request with empty content.- Parameters:
method
- the HTTP method of the requestpath
- the path of the request
-
of
static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, CharSequence content)
Creates a new HTTP request.- Parameters:
method
- the HTTP method of the requestpath
- the path of the requestmediaType
- theMediaType
of the request contentcontent
- the content of the request
-
of
static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, String content)
Creates a new HTTP request.- Parameters:
method
- the HTTP method of the requestpath
- the path of the requestmediaType
- theMediaType
of the request contentcontent
- the content of the request
-
of
static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, String format, Object... args)
Creates a new HTTP request. The content of the request is formatted byString.format(Locale, String, Object...)
with English locale.- Parameters:
method
- the HTTP method of the requestpath
- the path of the requestmediaType
- theMediaType
of the request contentformat
- the format string of the request contentargs
- the arguments referenced by the format specifiers in the format string
-
of
static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, byte[] content)
Creates a new HTTP request. Thecontent
will be wrapped usingHttpData.wrap(byte[])
, so any changes made tocontent
will be reflected in the request.- Parameters:
method
- the HTTP method of the requestpath
- the path of the requestmediaType
- theMediaType
of the request contentcontent
- the content of the request
-
of
static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, HttpData content)
Creates a new HTTP request.- Parameters:
method
- the HTTP method of the requestpath
- the path of the requestmediaType
- theMediaType
of the request contentcontent
- the content of the request
-
of
static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, HttpData content, HttpHeaders trailers)
Creates a new HTTP request.- Parameters:
method
- the HTTP method of the requestpath
- the path of the requestmediaType
- theMediaType
of the request contentcontent
- the content of the requesttrailers
- the HTTP trailers
-
of
static AggregatedHttpRequest of(RequestHeaders headers)
Creates a new HTTP request with empty content.- Parameters:
headers
- the HTTP request headers
-
of
static AggregatedHttpRequest of(RequestHeaders headers, HttpData content)
Creates a new HTTP request.- Parameters:
headers
- the HTTP request headerscontent
- the content of the request
-
of
static AggregatedHttpRequest of(RequestHeaders headers, HttpData content, HttpHeaders trailers)
Creates a new HTTP request.- Parameters:
headers
- the HTTP request headerscontent
- the content of the requesttrailers
- the HTTP trailers
-
headers
RequestHeaders headers()
Returns theRequestHeaders
.
-
method
HttpMethod method()
Returns the METHOD of this request.
-
scheme
@Nullable String scheme()
Returns the SCHEME of this request.- Returns:
- the scheme, or
null
if there's no such header
-
authority
@Nullable String authority()
Returns the AUTHORITY of this request, in the form of"hostname:port"
.- Returns:
- the authority, or
null
if there's no such header
-
toHttpRequest
default HttpRequest toHttpRequest()
Converts this request into a new completeHttpRequest
.- Returns:
- the new
HttpRequest
converted from this request.
-
trailingHeaders
@Deprecated default HttpHeaders trailingHeaders()
Deprecated.Usetrailers()
.Returns the HTTP trailers.
-
trailers
HttpHeaders trailers()
Returns the HTTP trailers.
-
content
HttpData content()
Returns the content of this message.
-
content
default String content(Charset charset)
Returns the content of this message as a string encoded in the specifiedCharset
.
-
contentUtf8
default String contentUtf8()
Returns the content of this message as a UTF-8 string.
-
contentAscii
default String contentAscii()
Returns the content of this message as an ASCII string.
-
contentType
@Nullable default MediaType contentType()
Returns the value of the'content-type'
header.- Returns:
- the valid header value if present.
null
otherwise.
-
-