trait RequestHeader extends AnyRef
The HTTP request header. Note that it doesn’t contain the request body yet.
- Self Type
- RequestHeader
- Annotations
- @implicitNotFound("Cannot find any HTTP Request Header here")
- Source
- RequestHeader.scala
- Alphabetic
- By Inheritance
- RequestHeader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def attrs: TypedMap
A map of typed attributes associated with the request.
- abstract def connection: RemoteConnection
The remote connection that made the request.
- abstract def headers: Headers
The HTTP headers.
- abstract def method: String
The HTTP method.
- abstract def target: RequestTarget
The target of the HTTP request, i.e.
The target of the HTTP request, i.e. the URI or path that was given on the first line of the request.
- abstract def version: String
The HTTP version.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- lazy val acceptLanguages: Seq[Lang]
The Request Langs extracted from the Accept-Language header and sorted by preference (preferred first).
- lazy val acceptedTypes: Seq[MediaRange]
- returns
The media types list of the request’s Accept header, sorted by preference (preferred first).
- def accepts(mimeType: String): Boolean
Check if this request accepts a given media type.
Check if this request accepts a given media type.
- returns
true if
mimeType
matches the Accept header, otherwise false
- def addAttr[A](key: TypedKey[A], value: A): RequestHeader
Create a new versions of this object with the given attribute attached to it.
Create a new versions of this object with the given attribute attached to it.
- A
The type of value.
- key
The new attribute key.
- value
The attribute value.
- returns
The new version of this object with the new attribute.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: mvc.Http.RequestHeader
- lazy val charset: Option[String]
Returns the charset of the request for text-based body
- final def clientCertificateChain: Option[Seq[X509Certificate]]
The X509 certificate chain presented by a client during SSL requests.
The X509 certificate chain presented by a client during SSL requests. This method is equivalent to
connection.clientCertificateChain
. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- lazy val contentType: Option[String]
Returns the value of the Content-Type header (without the parameters (eg charset))
- def cookies: Cookies
The HTTP cookies.
The HTTP cookies. The request's cookies are stored in an attribute indexed by play.api.mvc.request.RequestAttrKey.Cookies. The attribute uses a Cell to store the cookies, to allow them to be evaluated on-demand.
- lazy val domain: String
The HTTP domain.
The HTTP domain. The domain part of the request's host.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flash: Flash
Parses the
Flash
cookie and returns theFlash
data.Parses the
Flash
cookie and returns theFlash
data. The request's flash cookie is stored in an attribute indexed by play.api.mvc.request.RequestAttrKey.Flash. The attribute uses a play.api.mvc.request.Cell to store the flash, to allow it to be evaluated on-demand. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getQueryString(key: String): Option[String]
Helper method to access a queryString parameter.
Helper method to access a queryString parameter. This method delegates to
connection.getQueryParameter(key)
.- returns
The query parameter's value if the parameter is present and there is only one value. If the parameter is absent or there is more than one value for that parameter then
None
is returned.
- def hasBody: Boolean
True if this request has a body, so we know if we should trigger body parsing.
True if this request has a body, so we know if we should trigger body parsing. The base implementation simply checks for the Content-Length or Transfer-Encoding headers, but subclasses (such as fake requests) may return true in other cases so the headers need not be updated to reflect the body.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- lazy val host: String
The HTTP host (domain, optionally port).
The HTTP host (domain, optionally port). This value is derived from the request target, if a hostname is present. If the target doesn't have a host then the
Host
header is used, if present. If that's not present then an empty string is returned. - final def id: Long
The request id.
The request id. The request id is stored as an attribute indexed by play.api.mvc.request.RequestAttrKey.Id.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- lazy val mediaType: Option[MediaType]
The media type of this request.
The media type of this request. Same as contentType, except returns a fully parsed media type with parameters.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def path: String
The URI path.
The URI path. This method delegates to
target.path
. - final def queryString: Map[String, Seq[String]]
The parsed query string.
The parsed query string. This method delegates to
target.queryMap
. - def rawQueryString: String
Returns the raw query string.
Returns the raw query string. This method delegates to
connection.rawQueryString
. - final def remoteAddress: String
The client IP address.
The client IP address.
retrieves the last untrusted proxy from the Forwarded-Headers or the X-Forwarded-*-Headers.
This method delegates to
connection.remoteAddressString
. - def removeAttr(key: TypedKey[_]): RequestHeader
Create a new versions of this object with the given attribute removed.
Create a new versions of this object with the given attribute removed.
- key
The key of the attribute to remove.
- returns
The new version of this object with the attribute removed.
- final def secure: Boolean
Is the client using SSL? This method delegates to
connection.secure
. - def session: Session
Parses the
Session
cookie and returns theSession
data.Parses the
Session
cookie and returns theSession
data. The request's session cookie is stored in an attribute indexed by play.api.mvc.request.RequestAttrKey.Session. The attribute uses a play.api.mvc.request.Cell to store the session cookie, to allow it to be evaluated on-demand. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- RequestHeader → AnyRef → Any
- def transientLang(): Option[Lang]
The transient language will be taken into account when using play.api.i18n.MessagesApi.preferred() (It will take precedence over any other language).
The transient language will be taken into account when using play.api.i18n.MessagesApi.preferred() (It will take precedence over any other language).
- returns
The current transient language of this request.
- final def uri: String
The complete request URI, containing both path and query string.
The complete request URI, containing both path and query string. The URI is what was on the status line after the request method. E.g. in "GET /foo/bar?q=s HTTP/1.1" the URI should be /foo/bar?q=s. It could be absolute, some clients send absolute URLs, especially proxies, e.g. http://www.example.org/foo/bar?q=s.
This method delegates to
target.uriString
. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withAttrs(newAttrs: TypedMap): RequestHeader
Create a new version of this object with the given attributes attached to it.
Create a new version of this object with the given attributes attached to it. This replaces any existing attributes.
- newAttrs
The new attributes to add.
- returns
The new version of this object with the attributes attached.
- def withBody[A](body: A): Request[A]
Attach a body to this header.
Attach a body to this header.
- A
The type of the body.
- body
The body to attach.
- returns
A new request with the body attached to the header.
- def withConnection(newConnection: RemoteConnection): RequestHeader
- def withHeaders(newHeaders: Headers): RequestHeader
The remote connection that made the request.
- def withMethod(newMethod: String): RequestHeader
Return a new copy of the request with its method changed.
- def withTarget(newTarget: RequestTarget): RequestHeader
Return a new copy of the request with its target changed.
- def withTransientLang(locale: Locale): RequestHeader
Create a new versions of this object with the given transient language set.
Create a new versions of this object with the given transient language set. The transient language will be taken into account when using play.api.i18n.MessagesApi.preferred() (It will take precedence over any other language).
- locale
The language to use.
- returns
The new version of this object with the given transient language set.
- def withTransientLang(code: String): RequestHeader
Create a new versions of this object with the given transient language set.
Create a new versions of this object with the given transient language set. The transient language will be taken into account when using play.api.i18n.MessagesApi.preferred() (It will take precedence over any other language).
- code
The language to use.
- returns
The new version of this object with the given transient language set.
- def withTransientLang(lang: Lang): RequestHeader
Create a new versions of this object with the given transient language set.
Create a new versions of this object with the given transient language set. The transient language will be taken into account when using play.api.i18n.MessagesApi.preferred() (It will take precedence over any other language).
- lang
The language to use.
- returns
The new version of this object with the given transient language set.
- def withVersion(newVersion: String): RequestHeader
Return a new copy of the request with its HTTP version changed.
- def withoutTransientLang(): RequestHeader
Create a new versions of this object with the given transient language removed.
Create a new versions of this object with the given transient language removed.
- returns
The new version of this object with the transient language removed.