Class

play.api.mvc

Result

Related Doc: package mvc

Permalink

case class Result(header: ResponseHeader, body: HttpEntity, newSession: Option[Session] = None, newFlash: Option[Flash] = None, newCookies: Seq[Cookie] = Seq.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, Serializable, Product, Equals, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Result
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

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

    Permalink

    header

    the response header, which contains status code and HTTP headers

    body

    the response body

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addingToSession(values: (String, String)*)(implicit request: RequestHeader): Result

    Permalink

    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.

  5. def as(contentType: String): Result

    Permalink

    Changes the result content type.

    Changes the result content type.

    For example:

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

    the new content type.

    returns

    the new result

  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def asJava: mvc.Result

    Permalink

    Convert this result to a Java result.

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

    Permalink

    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.

  9. val body: HttpEntity

    Permalink

    the response body

  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def discardingCookies(cookies: DiscardingCookie*): Result

    Permalink

    Discards cookies along this result.

    Discards cookies along this result.

    For example:

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

    the cookies to discard along to this result

    returns

    the new result

  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def flashing(values: (String, String)*): Result

    Permalink

    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

  15. def flashing(flash: Flash): Result

    Permalink

    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

  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. val header: ResponseHeader

    Permalink

    the response header, which contains status code and HTTP headers

  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. val newCookies: Seq[Cookie]

    Permalink
  21. val newFlash: Option[Flash]

    Permalink
  22. val newSession: Option[Session]

    Permalink
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. def removingFromSession(keys: String*)(implicit request: RequestHeader): Result

    Permalink

    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.

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

    Permalink

    request

    Current request

    returns

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

  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink
    Definition Classes
    Result → AnyRef → Any
  29. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. def withCookies(cookies: Cookie*): Result

    Permalink

    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

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

    Permalink

    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.

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

    Permalink

    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

  35. def withNewSession: Result

    Permalink

    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

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

    Permalink

    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

  37. def withSession(session: Session): Result

    Permalink

    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

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped