Packages

c

play.api.mvc

MessagesRequest

class MessagesRequest[+A] extends WrappedRequest[A] with PreferredMessagesProvider with MessagesRequestHeader

This class is a wrapped Request that is "i18n-aware" and can return the preferred messages associated with the request.

A

the body type of the request

Source
MessagesRequest.scala
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MessagesRequest
  2. MessagesRequestHeader
  3. PreferredMessagesProvider
  4. MessagesProvider
  5. WrappedRequest
  6. Request
  7. RequestHeader
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new MessagesRequest(request: Request[A], messagesApi: MessagesApi)

    request

    the original request

    messagesApi

    the injected messagesApi

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. lazy val acceptLanguages: Seq[Lang]

    The Request Langs extracted from the Accept-Language header and sorted by preference (preferred first).

    The Request Langs extracted from the Accept-Language header and sorted by preference (preferred first).

    Definition Classes
    RequestHeader
  5. lazy val acceptedTypes: Seq[MediaRange]

    returns

    The media types list of the request’s Accept header, sorted by preference (preferred first).

    Definition Classes
    RequestHeader
  6. 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

    Definition Classes
    RequestHeader
  7. def addAttr[B](key: TypedKey[B], value: B): Request[A]

    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.

    key

    The new attribute key.

    value

    The attribute value.

    returns

    The new version of this object with the new attribute.

    Definition Classes
    RequestRequestHeader
  8. def addAttrs(entries: TypedEntry[_]*): Request[A]

    Create a new versions of this object with the given attributes attached to it.

    Create a new versions of this object with the given attributes attached to it.

    entries

    The new attributes.

    returns

    The new version of this object with the new attributes.

    Definition Classes
    RequestRequestHeader
  9. def addAttrs(e1: TypedEntry[_], e2: TypedEntry[_], e3: TypedEntry[_]): Request[A]

    Create a new versions of this object with the given attributes attached to it.

    Create a new versions of this object with the given attributes attached to it.

    e1

    The first new attribute.

    e2

    The second new attribute.

    e3

    The third new attribute.

    returns

    The new version of this object with the new attributes.

    Definition Classes
    RequestRequestHeader
  10. def addAttrs(e1: TypedEntry[_], e2: TypedEntry[_]): Request[A]

    Create a new versions of this object with the given attributes attached to it.

    Create a new versions of this object with the given attributes attached to it.

    e1

    The first new attribute.

    e2

    The second new attribute.

    returns

    The new version of this object with the new attributes.

    Definition Classes
    RequestRequestHeader
  11. def addAttrs(e1: TypedEntry[_]): Request[A]

    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.

    e1

    The new attribute.

    returns

    The new version of this object with the new attribute.

    Definition Classes
    RequestRequestHeader
  12. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  13. def asJava: mvc.Http.Request

    Be aware that when converting a Scala request to a Java request that the body will not be converted automatically to a Java equivalent body.

    Be aware that when converting a Scala request to a Java request that the body will not be converted automatically to a Java equivalent body. For example: If the Scala request contains a play.api.mvc.RawBuffer it will not be converted into it's Java equivalent play.mvc.Http.RawBuffer, or a Scala AnyContentAsEmpty will not be converted into a java.util.Optional.empty() (which is the Play Java equivalent of an empty body). Therefore helper methods like request.asJava.body().asRaw(), asJson(), etc. will very likely not work. You can however retrieve any stored body object by using request.asJava.body().as(classOf[Object]).

    Definition Classes
    RequestRequestHeader
  14. def attrs: TypedMap

    A map of typed attributes associated with the request.

    A map of typed attributes associated with the request.

    Definition Classes
    WrappedRequestRequestHeader
  15. def body: A

    The body content.

    The body content.

    Definition Classes
    WrappedRequestRequest
  16. lazy val charset: Option[String]

    Returns the charset of the request for text-based body

    Returns the charset of the request for text-based body

    Definition Classes
    RequestHeader
  17. 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.

    Definition Classes
    RequestHeader
  18. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  19. def connection: RemoteConnection

    The remote connection that made the request.

    The remote connection that made the request.

    Definition Classes
    WrappedRequestRequestHeader
  20. lazy val contentType: Option[String]

    Returns the value of the Content-Type header (without the parameters (eg charset))

    Returns the value of the Content-Type header (without the parameters (eg charset))

    Definition Classes
    RequestHeader
  21. 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.

    Definition Classes
    RequestHeader
  22. lazy val domain: String

    The HTTP domain.

    The HTTP domain. The domain part of the request's host.

    Definition Classes
    RequestHeader
  23. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  25. def flash: Flash

    Parses the Flash cookie and returns the Flash data.

    Parses the Flash cookie and returns the Flash 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.

    Definition Classes
    RequestHeader
  26. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  27. 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.

    Definition Classes
    RequestHeader
  28. def hasBody: Boolean

    True if this request has a body.

    True if this request has a body. This is either done by inspecting the request headers or the body itself to see if it is an entity representing an "empty" body.

    Definition Classes
    RequestRequestHeader
  29. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  30. def headers: Headers

    The HTTP headers.

    The HTTP headers.

    Definition Classes
    WrappedRequestRequestHeader
  31. 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.

    Definition Classes
    RequestHeader
  32. 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.

    Definition Classes
    RequestHeader
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. def map[B](f: (A) => B): Request[B]

    Transform the request body.

    Transform the request body.

    Definition Classes
    Request
  35. 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.

    Definition Classes
    RequestHeader
  36. lazy val messages: Messages

    returns

    the output from messagesApi.preferred(self)

    Definition Classes
    PreferredMessagesProviderMessagesProvider
  37. val messagesApi: MessagesApi

    returns

    the messagesApi used to produce a Messages instance.

    Definition Classes
    MessagesRequestPreferredMessagesProvider
  38. def method: String

    The HTTP method.

    The HTTP method.

    Definition Classes
    WrappedRequestRequestHeader
  39. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. def newWrapper[B](newRequest: Request[B]): WrappedRequest[B]

    Create a copy of this wrapper, but wrapping a new request.

    Create a copy of this wrapper, but wrapping a new request. Subclasses can override this method.

    Attributes
    protected
    Definition Classes
    WrappedRequest
  41. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  42. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  43. final def path: String

    The URI path.

    The URI path. This method delegates to target.path.

    Definition Classes
    RequestHeader
  44. final def queryString: Map[String, Seq[String]]

    The parsed query string.

    The parsed query string. This method delegates to target.queryMap.

    Definition Classes
    RequestHeader
  45. def rawQueryString: String

    Returns the raw query string.

    Returns the raw query string. This method delegates to connection.rawQueryString.

    Definition Classes
    RequestHeader
  46. 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.

    Definition Classes
    RequestHeader
  47. def removeAttr(key: TypedKey[_]): Request[A]

    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.

    Definition Classes
    RequestRequestHeader
  48. final def secure: Boolean

    Is the client using SSL? This method delegates to connection.secure.

    Is the client using SSL? This method delegates to connection.secure.

    Definition Classes
    RequestHeader
  49. def session: Session

    Parses the Session cookie and returns the Session data.

    Parses the Session cookie and returns the Session 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.

    Definition Classes
    RequestHeader
  50. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  51. 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.

    Definition Classes
    WrappedRequestRequestHeader
  52. def toString(): String
    Definition Classes
    RequestHeader → AnyRef → Any
  53. 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.

    Definition Classes
    RequestHeader
  54. 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.

    Definition Classes
    RequestHeader
  55. def version: String

    The HTTP version.

    The HTTP version.

    Definition Classes
    WrappedRequestRequestHeader
  56. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  57. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  58. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  59. def withAttrs(newAttrs: TypedMap): WrappedRequest[A]

    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.

    Definition Classes
    WrappedRequestRequestRequestHeader
  60. def withBody[B](body: B): WrappedRequest[B]

    Attach a body to this header.

    Attach a body to this header.

    body

    The body to attach.

    returns

    A new request with the body attached to the header.

    Definition Classes
    WrappedRequestRequestHeader
  61. def withConnection(newConnection: RemoteConnection): WrappedRequest[A]
    Definition Classes
    WrappedRequestRequestRequestHeader
  62. def withHeaders(newHeaders: Headers): WrappedRequest[A]

    The remote connection that made the request.

    The remote connection that made the request.

    Definition Classes
    WrappedRequestRequestRequestHeader
  63. def withMethod(newMethod: String): WrappedRequest[A]

    Return a new copy of the request with its method changed.

    Return a new copy of the request with its method changed.

    Definition Classes
    WrappedRequestRequestRequestHeader
  64. def withTarget(newTarget: RequestTarget): WrappedRequest[A]

    Return a new copy of the request with its target changed.

    Return a new copy of the request with its target changed.

    Definition Classes
    WrappedRequestRequestRequestHeader
  65. def withTransientLang(locale: Locale): Request[A]

    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.

    Definition Classes
    RequestRequestHeader
  66. def withTransientLang(code: String): Request[A]

    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.

    Definition Classes
    RequestRequestHeader
  67. def withTransientLang(lang: Lang): Request[A]

    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.

    Definition Classes
    RequestRequestHeader
  68. def withVersion(newVersion: String): WrappedRequest[A]

    Return a new copy of the request with its HTTP version changed.

    Return a new copy of the request with its HTTP version changed.

    Definition Classes
    WrappedRequestRequestRequestHeader
  69. def withoutTransientLang(): Request[A]

    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.

    Definition Classes
    RequestRequestHeader

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from MessagesRequestHeader

Inherited from MessagesProvider

Inherited from WrappedRequest[A]

Inherited from Request[A]

Inherited from RequestHeader

Inherited from AnyRef

Inherited from Any

Ungrouped