play.api.mvc

Result

Related Doc: package mvc

case class Result(header: ResponseHeader, body: Enumerator[Array[Byte]], connection: Connection = HttpConnection.KeepAlive) 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

connection

the connection semantics to use

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
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Result(header: ResponseHeader, body: Enumerator[Array[Byte]], connection: Connection = HttpConnection.KeepAlive)

    header

    the response header, which contains status code and HTTP headers

    body

    the response body

    connection

    the connection semantics to use

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 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.

  5. def as(contentType: String): Result

    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

    Definition Classes
    Any
  7. val body: Enumerator[Array[Byte]]

    the response body

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. val connection: Connection

    the connection semantics to use

  10. def discardingCookies(cookies: DiscardingCookie*): Result

    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

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

    Definition Classes
    AnyRef
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. 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

  14. 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

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

    Definition Classes
    AnyRef → Any
  16. val header: ResponseHeader

    the response header, which contains status code and HTTP headers

  17. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

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

  22. 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.

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

    Definition Classes
    AnyRef
  24. def toString(): String

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

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

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

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

    Adds cookies to this result.

    Adds cookies to this result. If the result already contains cookies then the new cookies will be merged with the old cookies.

    For example:

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

    the cookies to add to this result

    returns

    the new result

  29. def withDateHeaders(headers: (String, DateTime)*): 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
    returns

  30. 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

  31. 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

  32. 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

  33. 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

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped