Package com.linecorp.armeria.common
Interface AggregatedHttpRequest
- All Superinterfaces:
AggregatedHttpObject
public interface AggregatedHttpRequest
A complete HTTP request whose content is readily available as a single
HttpData
.-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable List<Locale.LanguageRange>
Returns a list ofLocale.LanguageRange
s that are specified inHttpHeaderNames.ACCEPT_LANGUAGE
in the order of client-side preferences.Returns the authority of this request.headers()
Returns theRequestHeaders
.default 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
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.default String
path()
Returns the path of this request.scheme()
Returns the scheme of this request.selectLocale(Iterable<Locale> supportedLocales)
Matches theLocale
s supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGE
and returning the best match according to client preference.selectLocale(Locale... supportedLocales)
Matches theLocale
s supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGE
and returning the best match according to client preference.default HttpRequest
Converts this request into a new completeHttpRequest
.trailers()
Returns the HTTP trailers.default URI
uri()
Returns the URI of this request.Methods inherited from interface com.linecorp.armeria.common.AggregatedHttpObject
content, content, contentAscii, contentType, contentUtf8
-
Method Details
-
of
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
@FormatMethod static AggregatedHttpRequest of(HttpMethod method, String path, MediaType mediaType, @FormatString 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
Creates a new HTTP request with empty content.- Parameters:
headers
- the HTTP request headers
-
of
Creates a new HTTP request.- Parameters:
headers
- the HTTP request headerscontent
- the content of the request
-
of
Creates a new HTTP request.- Parameters:
headers
- the HTTP request headerscontent
- the content of the requesttrailers
- the HTTP trailers
-
headers
RequestHeaders headers()Returns theRequestHeaders
.- Specified by:
headers
in interfaceAggregatedHttpObject
-
uri
Returns the URI of this request. This method is a shortcut forheaders().uri()
. -
scheme
Returns the scheme of this request. This method is a shortcut forheaders().scheme()
. -
method
Returns the method of this request. This method is a shortcut forheaders().method()
. -
path
Returns the path of this request. This method is a shortcut forheaders().path()
. -
authority
Returns the authority of this request. This method is a shortcut forheaders().authority()
. -
acceptLanguages
Returns a list ofLocale.LanguageRange
s that are specified inHttpHeaderNames.ACCEPT_LANGUAGE
in the order of client-side preferences. If the client does not send the header, this will contain only a wild cardLocale.LanguageRange
. -
selectLocale
Matches theLocale
s supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGE
and returning the best match according to client preference. It does this viaBasic Filtering eachLocale.LanguageRange
and picking the first match. This is the "classic" algorithm described in RFC2616 Accept-Language (obsoleted) and also referenced in RFC7231 Accept-Language. -
selectLocale
Matches theLocale
s supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGE
and returning the best match according to client preference. It does this viaBasic Filtering eachLocale.LanguageRange
and picking the first match. This is the "classic" algorithm described in RFC2616 Accept-Language (obsoleted) and also referenced in RFC7231 Accept-Language. -
toHttpRequest
Converts this request into a new completeHttpRequest
.- Returns:
- the new
HttpRequest
converted from this request.
-
trailers
HttpHeaders trailers()Returns the HTTP trailers.
-