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
- Alphabetic
- By Inheritance
- Result
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Result(header: ResponseHeader, body: HttpEntity, newSession: Option[Session] = None, newFlash: Option[Flash] = None, newCookies: Seq[Cookie] = Seq.empty)
- header
the response header, which contains status code and HTTP headers
- body
the response body
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
-
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.
-
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
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: mvc.Result
Convert this result to a Java result.
-
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.
- val body: HttpEntity
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
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
-
def
discardingHeader(name: String): Result
Discards headers to this result.
Discards headers to this result.
For example:
Ok("Hello world").discardingHeader(ETAG)
- returns
the new result
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
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
-
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
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val header: ResponseHeader
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val newCookies: Seq[Cookie]
- val newFlash: Option[Flash]
- val newSession: Option[Session]
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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.
-
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.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Result → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
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
-
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.
-
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
-
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
-
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
-
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