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.LanguageRanges that are specified inHttpHeaderNames.ACCEPT_LANGUAGEin the order of client-side preferences.Returns the authority of this request.headers()Returns theRequestHeaders.default HttpMethodmethod()Returns the method of this request.static AggregatedHttpRequestof(HttpMethod method, String path)Creates a new HTTP request with empty content.static AggregatedHttpRequestof(HttpMethod method, String path, MediaType mediaType, byte[] content)Creates a new HTTP request.static AggregatedHttpRequestof(HttpMethod method, String path, MediaType mediaType, HttpData content)Creates a new HTTP request.static AggregatedHttpRequestof(HttpMethod method, String path, MediaType mediaType, HttpData content, HttpHeaders trailers)Creates a new HTTP request.static AggregatedHttpRequestof(HttpMethod method, String path, MediaType mediaType, CharSequence content)Creates a new HTTP request.static AggregatedHttpRequestof(HttpMethod method, String path, MediaType mediaType, String content)Creates a new HTTP request.static AggregatedHttpRequestCreates a new HTTP request.static AggregatedHttpRequestof(RequestHeaders headers)Creates a new HTTP request with empty content.static AggregatedHttpRequestof(RequestHeaders headers, HttpData content)Creates a new HTTP request.static AggregatedHttpRequestof(RequestHeaders headers, HttpData content, HttpHeaders trailers)Creates a new HTTP request.default Stringpath()Returns the path of this request.scheme()Returns the scheme of this request.selectLocale(Iterable<Locale> supportedLocales)Matches theLocales supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGEand returning the best match according to client preference.selectLocale(Locale... supportedLocales)Matches theLocales supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGEand returning the best match according to client preference.default HttpRequestConverts this request into a new completeHttpRequest.trailers()Returns the HTTP trailers.default URIuri()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- theMediaTypeof 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- theMediaTypeof 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- theMediaTypeof 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. Thecontentwill be wrapped usingHttpData.wrap(byte[]), so any changes made tocontentwill be reflected in the request.- Parameters:
method- the HTTP method of the requestpath- the path of the requestmediaType- theMediaTypeof 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- theMediaTypeof 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- theMediaTypeof 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:
headersin 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.LanguageRanges that are specified inHttpHeaderNames.ACCEPT_LANGUAGEin the order of client-side preferences. If the client does not send the header, this will contain only a wild cardLocale.LanguageRange. -
selectLocale
Matches theLocales supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGEand returning the best match according to client preference. It does this viaBasic Filtering eachLocale.LanguageRangeand picking the first match. This is the "classic" algorithm described in RFC2616 Accept-Language (obsoleted) and also referenced in RFC7231 Accept-Language. -
selectLocale
Matches theLocales supported by the server to theHttpHeaderNames.ACCEPT_LANGUAGEand returning the best match according to client preference. It does this viaBasic Filtering eachLocale.LanguageRangeand 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
HttpRequestconverted from this request.
-
trailers
HttpHeaders trailers()Returns the HTTP trailers.
-