Packages

case class Result(header: ResponseHeader, body: HttpEntity, newSession: Option[Session] = None, newFlash: Option[Flash] = None, newCookies: Seq[Cookie] = Seq.empty, attrs: TypedMap = TypedMap.empty) extends Product with Serializable

A simple result, which defines the response header and a body ready to send to the client.

header

the response header, which contains status code and HTTP headers

body

the response body

Source
Results.scala
Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Result
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Result(header: ResponseHeader, body: HttpEntity, newSession: Option[Session] = None, newFlash: Option[Flash] = None, newCookies: Seq[Cookie] = Seq.empty, attrs: TypedMap = TypedMap.empty)

    header

    the response header, which contains status code and HTTP headers

    body

    the response body

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. def addAttr[A](key: TypedKey[A], value: A): Result

    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.

  5. def addAttrs(entries: TypedEntry[_]*): Result

    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.

  6. def addAttrs(e1: TypedEntry[_], e2: TypedEntry[_], e3: TypedEntry[_]): Result

    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.

  7. def addAttrs(e1: TypedEntry[_], e2: TypedEntry[_]): Result

    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.

  8. def addAttrs(e1: TypedEntry[_]): Result

    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.

  9. def addingToSession(values: (String, String)*)(implicit request: RequestHeader): Result

    Example:

    Example:

    Ok.addingToSession("foo" -> "bar").addingToSession("baz" -> "bah")
    values

    (key -> value) pairs to add to this result’s session

    request

    Current request

    returns

    A copy of this result with values added to its session scope.

  10. def as(contentType: String): Result

    Changes the result content type.

    Changes the result content type.

    For example:

    Ok("<text>Hello world</text>").as("application/xml")
    contentType

    the new content type.

    returns

    the new result

  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def asJava: mvc.Result

    Convert this result to a Java result.

  13. val attrs: TypedMap
  14. def bakeCookies(cookieHeaderEncoding: CookieHeaderEncoding = new DefaultCookieHeaderEncoding(), sessionBaker: CookieBaker[Session] = new DefaultSessionCookieBaker(), flashBaker: CookieBaker[Flash] = new DefaultFlashCookieBaker(), requestHasFlash: Boolean = false): Result

    Encode the cookies into the Set-Cookie header.

    Encode the cookies into the Set-Cookie header. The session is always baked first, followed by the flash cookie, followed by all the other cookies in order.

  15. val body: HttpEntity
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  17. def discardingCookies(cookies: DiscardingCookie*): Result

    Discards cookies along this result.

    Discards cookies along this result.

    For example:

    Redirect(routes.Application.index()).discardingCookies(DiscardingCookie("theme"))
    cookies

    the cookies to discard along to this result

    returns

    the new result

  18. def discardingHeader(name: String): Result

    Discards headers to this result.

    Discards headers to this result.

    For example:

    Ok("Hello world").discardingHeader(ETAG)
    name

    the header to discard from this result.

    returns

    the new result

  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def flashing(values: (String, String)*): Result

    Adds values to the flash scope for this result.

    Adds values to the flash scope for this result.

    For example:

    Redirect(routes.Application.index()).flashing("success" -> "Done!")
    values

    the flash values to set with this result

    returns

    the new result

  21. def flashing(flash: Flash): Result

    Adds values to the flash scope for this result.

    Adds values to the flash scope for this result.

    For example:

    Redirect(routes.Application.index()).flashing(flash + ("success" -> "Done!"))
    flash

    the flash scope to set with this result

    returns

    the new result

  22. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  23. val header: ResponseHeader
  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. val newCookies: Seq[Cookie]
  27. val newFlash: Option[Flash]
  28. val newSession: Option[Session]
  29. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  30. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  31. def productElementNames: Iterator[String]
    Definition Classes
    Product
  32. def removeAttr(key: TypedKey[_]): Result

    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.

  33. def removingFromSession(keys: String*)(implicit request: RequestHeader): Result

    Example:

    Example:

    Ok.removingFromSession("foo")
    keys

    Keys to remove from session

    request

    Current request

    returns

    A copy of this result with keys removed from its session scope.

  34. def session(implicit request: RequestHeader): Session

    request

    Current request

    returns

    The session carried by this result. Reads the request’s session if this result does not modify the session.

  35. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  36. def toString(): String
    Definition Classes
    Result → AnyRef → Any
  37. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  38. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  39. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  40. def withAttrs(newAttrs: TypedMap): Result

    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.

  41. def withCookies(cookies: Cookie*): Result

    Adds cookies to this result.

    Adds cookies to this result. If the result already contains cookies then cookies with the same name in the new list will override existing ones.

    For example:

    Redirect(routes.Application.index()).withCookies(Cookie("theme", "blue"))
    cookies

    the cookies to add to this result

    returns

    the new result

  42. def withDateHeaders(headers: (String, ZonedDateTime)*): Result

    Add a header with a DateTime formatted using the default http date format

    Add a header with a DateTime formatted using the default http date format

    headers

    the headers with a DateTime to add to this result.

    returns

    the new result.

  43. def withHeaders(headers: (String, String)*): Result

    Adds headers to this result.

    Adds headers to this result.

    For example:

    Ok("Hello world").withHeaders(ETAG -> "0")
    headers

    the headers to add to this result.

    returns

    the new result

  44. def withNewSession: Result

    Discards the existing session for this result.

    Discards the existing session for this result.

    For example:

    Redirect(routes.Application.index()).withNewSession
    returns

    the new result

  45. def withSession(session: (String, String)*): Result

    Sets a new session for this result, discarding the existing session.

    Sets a new session for this result, discarding the existing session.

    For example:

    Redirect(routes.Application.index()).withSession("saidHello" -> "yes")
    session

    the session to set with this result

    returns

    the new result

  46. def withSession(session: Session): Result

    Sets a new session for this result.

    Sets a new session for this result.

    For example:

    Redirect(routes.Application.index()).withSession(session + ("saidHello" -> "true"))
    session

    the session to set with this result

    returns

    the new result

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 Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped