public static interface Http.RequestHeader
Modifier and Type | Method and Description |
---|---|
java.util.List<play.api.http.MediaRange> |
acceptedTypes() |
java.util.List<Lang> |
acceptLanguages()
The Request Langs extracted from the Accept-Language header and sorted by preference
(preferred first).
|
boolean |
accepts(java.lang.String mimeType)
Check if this request accepts a given media type.
|
<A> Http.RequestHeader |
addAttr(TypedKey<A> key,
A value)
Create a new versions of this object with the given attribute attached to it.
|
play.api.mvc.RequestHeader |
asScala()
Return the Scala version of the request header.
|
TypedMap |
attrs() |
java.util.Optional<java.lang.String> |
charset()
Get the charset of the request.
|
java.util.Optional<java.util.List<java.security.cert.X509Certificate>> |
clientCertificateChain()
The X509 certificate chain presented by a client during SSL requests.
|
java.util.Optional<java.lang.String> |
contentType()
Get the content type of the request.
|
Http.Cookie |
cookie(java.lang.String name) |
Http.Cookies |
cookies() |
default Http.Flash |
flash()
Parses the Flash cookie and returns the Flash data.
|
Http.Headers |
getHeaders()
Retrieve all headers.
|
java.lang.String |
getQueryString(java.lang.String key)
Helper method to access a queryString parameter.
|
boolean |
hasBody()
Checks if the request has a body.
|
default boolean |
hasHeader(java.lang.String headerName)
Checks if the request has the header.
|
default java.util.Optional<java.lang.String> |
header(java.lang.String headerName)
Retrieves a single header.
|
java.lang.String |
host()
The request host.
|
default java.lang.Long |
id()
The request id.
|
java.lang.String |
method()
The HTTP Method.
|
java.lang.String |
path()
The URI path.
|
java.util.Map<java.lang.String,java.lang.String[]> |
queryString()
The query string content.
|
java.lang.String |
remoteAddress()
The client IP address.
|
Http.RequestHeader |
removeAttr(TypedKey<?> key)
Create a new versions of this object with the given attribute removed.
|
boolean |
secure()
Is the client using SSL?
|
default Http.Session |
session()
Parses the Session cookie and returns the Session data.
|
default java.util.Optional<Lang> |
transientLang()
The transient language will be taken into account when using
MessagesApi#preferred(RequestHeader) } (It will take precedence over any other language). |
java.lang.String |
uri()
The complete request URI, containing both path and query string.
|
java.lang.String |
version()
The HTTP version.
|
Http.RequestHeader |
withAttrs(TypedMap newAttrs)
Create a new version of this object with the given attributes attached to it.
|
Http.Request |
withBody(Http.RequestBody body)
Attach a body to this header.
|
default Http.RequestHeader |
withoutTransientLang()
Create a new version of this object with the given transient language removed.
|
default Http.RequestHeader |
withTransientLang(Lang lang)
Create a new version of this object with the given transient language set.
|
default Http.RequestHeader |
withTransientLang(java.util.Locale locale)
Create a new version of this object with the given transient language set.
|
default Http.RequestHeader |
withTransientLang(java.lang.String code)
Create a new version of this object with the given transient language set.
|
default java.lang.Long id()
RequestAttrKey.Id()
.java.lang.String uri()
java.lang.String method()
java.lang.String version()
java.lang.String remoteAddress()
retrieves the last untrusted proxy from the Forwarded-Headers or the X-Forwarded-*-Headers.
boolean secure()
TypedMap attrs()
Http.RequestHeader withAttrs(TypedMap newAttrs)
newAttrs
- The new attributes to add.<A> Http.RequestHeader addAttr(TypedKey<A> key, A value)
A
- the attribute typekey
- The new attribute key.value
- The attribute value.Http.RequestHeader removeAttr(TypedKey<?> key)
key
- The key of the attribute to remove.Http.Request withBody(Http.RequestBody body)
body
- The body to attach.java.lang.String host()
java.lang.String path()
java.util.List<Lang> acceptLanguages()
java.util.List<play.api.http.MediaRange> acceptedTypes()
boolean accepts(java.lang.String mimeType)
mimeType
- the mimeType to check for support.mimeType
is in the Accept header, otherwise falsejava.util.Map<java.lang.String,java.lang.String[]> queryString()
java.lang.String getQueryString(java.lang.String key)
key
- the query string parameter to look upkey
.Http.Cookies cookies()
Http.Cookie cookie(java.lang.String name)
name
- Name of the cookie to retrievedefault Http.Session session()
RequestAttrKey.Session()
. The attribute uses a
Cell
to store the session cookie, to allow it to be evaluated on-demand.default Http.Flash flash()
RequestAttrKey.Flash()
}. The attribute uses a Cell
to
store the flash, to allow it to be evaluated on-demand.Http.Headers getHeaders()
default java.util.Optional<java.lang.String> header(java.lang.String headerName)
headerName
- The name of the header (case-insensitive)headerName
, or empty if it was not presentdefault boolean hasHeader(java.lang.String headerName)
headerName
- The name of the header (case-insensitive)true
if the request did contain the header.boolean hasBody()
java.util.Optional<java.lang.String> contentType()
java.util.Optional<java.lang.String> charset()
java.util.Optional<java.util.List<java.security.cert.X509Certificate>> clientCertificateChain()
default Http.RequestHeader withTransientLang(Lang lang)
MessagesApi#preferred(RequestHeader)
}
(It will take precedence over any other language).lang
- The language to use.default Http.RequestHeader withTransientLang(java.lang.String code)
MessagesApi#preferred(RequestHeader)
}
(It will take precedence over any other language).code
- The language to use.default Http.RequestHeader withTransientLang(java.util.Locale locale)
MessagesApi#preferred(RequestHeader)
}
(It will take precedence over any other language).locale
- The language to use.default Http.RequestHeader withoutTransientLang()
default java.util.Optional<Lang> transientLang()
MessagesApi#preferred(RequestHeader)
} (It will take precedence over any other language).play.api.mvc.RequestHeader asScala()
RequestHeader