class Status extends Result
Generates default Result
from a content type, headers and content.
- Source
- Results.scala
- Alphabetic
- By Inheritance
- Status
- Result
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Status(status: Int)
- status
the HTTP response status, e.g ‘200 OK’
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.
- Definition Classes
- Result
-
def
apply[C](content: C)(implicit writeable: Writeable[C]): Result
Set the result's content.
Set the result's content.
- content
The content to send.
-
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
- Definition Classes
- Result
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: mvc.Result
Convert this result to a Java result.
Convert this result to a Java result.
- Definition Classes
- 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.
- Definition Classes
- Result
-
val
body: HttpEntity
- Definition Classes
- Result
-
def
chunked[C](content: Source[C, _])(implicit writeable: Writeable[C]): Result
Feed the content as the response, using chunked transfer encoding.
Feed the content as the response, using chunked transfer encoding.
Chunked transfer encoding is only supported for HTTP 1.1 clients. If the client is an HTTP 1.0 client, Play will instead return a 505 error code.
Chunked encoding allows the server to send a response where the content length is not known, or for potentially infinite streams, while still allowing the connection to be kept alive and reused for the next request.
- content
Source providing the content to stream.
-
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
- Definition Classes
- 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
- Definition Classes
- 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
- Definition Classes
- 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
- Definition Classes
- Result
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
val
header: ResponseHeader
- Definition Classes
- Result
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
val
newCookies: Seq[Cookie]
- Definition Classes
- Result
-
val
newFlash: Option[Flash]
- Definition Classes
- Result
-
val
newSession: Option[Session]
- Definition Classes
- Result
-
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.
- Definition Classes
- Result
-
def
sendEntity(entity: HttpEntity): Result
Send an HTTP entity with this status.
-
def
sendFile(content: File, inline: Boolean = true, fileName: (File) ⇒ String = _.getName, onClose: () ⇒ Unit = () => ())(implicit ec: ExecutionContext, fileMimeTypes: FileMimeTypes): Result
Send a file.
Send a file.
- content
The file to send.
- inline
Use Content-Disposition inline or attachment.
- fileName
Function to retrieve the file name. By default the name of the file is used.
-
def
sendPath(content: Path, inline: Boolean = true, fileName: (Path) ⇒ String = _.getFileName.toString, onClose: () ⇒ Unit = () => ())(implicit ec: ExecutionContext, fileMimeTypes: FileMimeTypes): Result
Send a path.
Send a path.
- content
The path to send.
- inline
Use Content-Disposition inline or attachment.
- fileName
Function to retrieve the file name. By default the name of the file is used.
-
def
sendResource(resource: String, classLoader: ClassLoader = Results.getClass.getClassLoader, inline: Boolean = true)(implicit fileMimeTypes: FileMimeTypes): Result
Send the given resource from the given classloader.
Send the given resource from the given classloader.
- resource
The path of the resource to load.
- classLoader
The classloader to load it from, defaults to the classloader for this class.
- inline
Whether it should be served as an inline file, or as an attachment.
-
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.
- Definition Classes
- Result
-
def
streamed[C](content: Source[C, _], contentLength: Option[Long], contentType: Option[String] = None)(implicit writeable: Writeable[C]): Result
Feed the content as the response, using a streamed entity.
Feed the content as the response, using a streamed entity.
It will use the given Content-Type, but if is not present, then it fallsback to use the Writeable contentType.
- content
Source providing the content to stream.
- contentLength
an optional content length.
- contentType
an optional content type.
-
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
- Definition Classes
- 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.
- Definition Classes
- 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
- Definition Classes
- 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
- Definition Classes
- 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
- Definition Classes
- 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
- Definition Classes
- Result