MessagesInjectedController

play.api.mvc.MessagesInjectedController

A variation of MessagesAbstractController that gets its components via method injection.

Attributes

Graph
Supertypes
trait Rendering
trait ContentTypes
trait HeaderNames
trait Status
trait HttpProtocol
trait Results
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited classlikes

object &

Convenient extractor allowing to apply two extractors. Example of use:

Convenient extractor allowing to apply two extractors. Example of use:

request match {
 case Accepts.Json() & Accepts.Html() => "This request accepts both JSON and HTML"
}

Attributes

Inherited from:
RequestExtractors
Supertypes
class Object
trait Matchable
class Any
object Accepts

Common extractors to check if a request accepts JSON, Html, etc. Example of use:

Common extractors to check if a request accepts JSON, Html, etc. Example of use:

request match {
 case Accepts.Json() => Ok(toJson(value))
 case _ => Ok(views.html.show(value))
}

Attributes

Inherited from:
AcceptExtractors
Supertypes
class Object
trait Matchable
class Any
class Status(status: Int) extends Result

Generates default Result from a content type, headers and content.

Generates default Result from a content type, headers and content.

Value parameters

status

the HTTP response status, e.g ‘200 OK’

Attributes

Inherited from:
Results
Supertypes
class Result
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object render

Attributes

Inherited from:
Rendering
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

The components needed to use the controller methods

The components needed to use the controller methods

Attributes

Definition Classes

Defines fallback components to use in case setControllerComponents has not been called.

Defines fallback components to use in case setControllerComponents has not been called.

Attributes

@Inject

Call this method to set the ControllerComponents instance.

Call this method to set the ControllerComponents instance.

Attributes

Inherited methods

def CSS(implicit codec: Codec): String

Content-Type of css.

Content-Type of css.

Attributes

Inherited from:
ContentTypes
def EVENT_STREAM(implicit codec: Codec): String

Content-Type of server sent events.

Content-Type of server sent events.

Attributes

Inherited from:
ContentTypes
def Found(url: String): Result

Generates a ‘302 FOUND’ simple result.

Generates a ‘302 FOUND’ simple result.

Value parameters

url

the URL to redirect to

Attributes

Inherited from:
Results
def HTML(implicit codec: Codec): String

Content-Type of html.

Content-Type of html.

Attributes

Inherited from:
ContentTypes
def JAVASCRIPT(implicit codec: Codec): String

Content-Type of javascript.

Content-Type of javascript.

Attributes

Inherited from:
ContentTypes
def MovedPermanently(url: String): Result

Generates a ‘301 MOVED_PERMANENTLY’ simple result.

Generates a ‘301 MOVED_PERMANENTLY’ simple result.

Value parameters

url

the URL to redirect to

Attributes

Inherited from:
Results
def PermanentRedirect(url: String): Result

Generates a ‘308 PERMANENT_REDIRECT’ simple result.

Generates a ‘308 PERMANENT_REDIRECT’ simple result.

Value parameters

url

the URL to redirect to

Attributes

Inherited from:
Results
def Redirect(call: Call, status: Int): Result

Generates a redirect simple result.

Generates a redirect simple result.

Value parameters

call

Call defining the URL to redirect to, which typically comes from the reverse router

status

HTTP status for redirect, such as SEE_OTHER, MOVED_TEMPORARILY or MOVED_PERMANENTLY

Attributes

Inherited from:
Results
def Redirect(call: Call): Result

Generates a redirect simple result.

Generates a redirect simple result.

Value parameters

call

Call defining the URL to redirect to, which typically comes from the reverse router

Attributes

Inherited from:
Results
def Redirect(url: String, queryStringParams: Map[String, Seq[String]], status: Int): Result

Generates a redirect simple result.

Generates a redirect simple result.

Value parameters

queryStringParams

queryString parameters to add to the queryString

status

HTTP status for redirect, such as SEE_OTHER, MOVED_TEMPORARILY or MOVED_PERMANENTLY

url

the URL to redirect to

Attributes

Inherited from:
Results
def Redirect(url: String, statusCode: Int): Result

Generates a redirect simple result.

Generates a redirect simple result.

Value parameters

statusCode

HTTP status

url

the URL to redirect to

Attributes

Inherited from:
Results
def SeeOther(url: String): Result

Generates a ‘303 SEE_OTHER’ simple result.

Generates a ‘303 SEE_OTHER’ simple result.

Value parameters

url

the URL to redirect to

Attributes

Inherited from:
Results
def Status(code: Int): Status

Generates a simple result.

Generates a simple result.

Value parameters

code

the status code

Attributes

Inherited from:
Results
def TEXT(implicit codec: Codec): String

Content-Type of text.

Content-Type of text.

Attributes

Inherited from:
ContentTypes
def TemporaryRedirect(url: String): Result

Generates a ‘307 TEMPORARY_REDIRECT’ simple result.

Generates a ‘307 TEMPORARY_REDIRECT’ simple result.

Value parameters

url

the URL to redirect to

Attributes

Inherited from:
Results
def XHTML(implicit codec: Codec): String

Content-Type of xhtml.

Content-Type of xhtml.

Attributes

Inherited from:
ContentTypes
def XML(implicit codec: Codec): String

Content-Type of xml.

Content-Type of xml.

Attributes

Inherited from:
ContentTypes
def defaultExecutionContext: ExecutionContext

The default execution context provided by Play. You should use this for non-blocking code only. You can do so by passing it explicitly, or by defining an implicit in your controller like so:

The default execution context provided by Play. You should use this for non-blocking code only. You can do so by passing it explicitly, or by defining an implicit in your controller like so:

 implicit lazy val executionContext = defaultExecutionContext

Attributes

Inherited from:
BaseControllerHelpers

The default body parsers provided by Play. This can be used along with the Action helper to customize the body parser, for example:

The default body parsers provided by Play. This can be used along with the Action helper to customize the body parser, for example:

 def foo(query: String) = Action(parse.tolerantJson) { request =>
   Ok(request.body)
 }

Attributes

Inherited from:
BaseControllerHelpers
def withCharset(mimeType: String)(implicit codec: Codec): String

Attributes

Returns

the codec charset appended to mimeType

Inherited from:
ContentTypes

Inherited fields

val ACCEPT: String

Attributes

Inherited from:
HeaderNames
val ACCEPTED: Int

Attributes

Inherited from:
Status
val ACCEPT_CHARSET: String

Attributes

Inherited from:
HeaderNames
val ACCEPT_ENCODING: String

Attributes

Inherited from:
HeaderNames
val ACCEPT_LANGUAGE: String

Attributes

Inherited from:
HeaderNames
val ACCEPT_RANGES: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames
val AGE: String

Attributes

Inherited from:
HeaderNames
val ALLOW: String

Attributes

Inherited from:
HeaderNames
val AUTHORIZATION: String

Attributes

Inherited from:
HeaderNames

Generates a ‘202 ACCEPTED’ result.

Generates a ‘202 ACCEPTED’ result.

Attributes

Inherited from:
Results
val BAD_GATEWAY: Int

Attributes

Inherited from:
Status
val BAD_REQUEST: Int

Attributes

Inherited from:
Status
val BINARY: String

Content-Type of binary data.

Content-Type of binary data.

Attributes

Inherited from:
ContentTypes

Generates a ‘502 BAD_GATEWAY’ result.

Generates a ‘502 BAD_GATEWAY’ result.

Attributes

Inherited from:
Results

Generates a ‘400 BAD_REQUEST’ result.

Generates a ‘400 BAD_REQUEST’ result.

Attributes

Inherited from:
Results
val CACHE_CONTROL: String

Attributes

Inherited from:
HeaderNames
val CACHE_MANIFEST: String

Content-Type of application cache.

Content-Type of application cache.

Attributes

Inherited from:
ContentTypes
val CHUNKED: String

Attributes

Inherited from:
HttpProtocol
val CONFLICT: Int

Attributes

Inherited from:
Status
val CONNECTION: String

Attributes

Inherited from:
HeaderNames
val CONTENT_DISPOSITION: String

Attributes

Inherited from:
HeaderNames
val CONTENT_ENCODING: String

Attributes

Inherited from:
HeaderNames
val CONTENT_LANGUAGE: String

Attributes

Inherited from:
HeaderNames
val CONTENT_LENGTH: String

Attributes

Inherited from:
HeaderNames
val CONTENT_LOCATION: String

Attributes

Inherited from:
HeaderNames
val CONTENT_MD5: String

Attributes

Inherited from:
HeaderNames
val CONTENT_RANGE: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames
val CONTENT_TYPE: String

Attributes

Inherited from:
HeaderNames
val CONTINUE: Int

Attributes

Inherited from:
Status
val CREATED: Int

Attributes

Inherited from:
Status

Generates a ‘409 CONFLICT’ result.

Generates a ‘409 CONFLICT’ result.

Attributes

Inherited from:
Results

Generates a ‘100 Continue’ result.

Generates a ‘100 Continue’ result.

Attributes

Inherited from:
Results

Generates a ‘201 CREATED’ result.

Generates a ‘201 CREATED’ result.

Attributes

Inherited from:
Results
val DATE: String

Attributes

Inherited from:
HeaderNames
val ETAG: String

Attributes

Inherited from:
HeaderNames
val EXPECT: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status
val EXPIRES: String

Attributes

Inherited from:
HeaderNames

Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

Generates a ‘413 REQUEST_ENTITY_TOO_LARGE’ result.

Attributes

Inherited from:
Results

Generates a ‘417 EXPECTATION_FAILED’ result.

Generates a ‘417 EXPECTATION_FAILED’ result.

Attributes

Inherited from:
Results

Attributes

Inherited from:
Status
val FORBIDDEN: Int

Attributes

Inherited from:
Status
val FORM: String

Content-Type of form-urlencoded. This content type does not define a charset parameter.

Content-Type of form-urlencoded. This content type does not define a charset parameter.

Attributes

Inherited from:
ContentTypes
val FORWARDED: String

Attributes

Inherited from:
HeaderNames
val FOUND: Int

Attributes

Inherited from:
Status
val FROM: String

Attributes

Inherited from:
HeaderNames

Generates a ‘424 FAILED_DEPENDENCY’ result.

Generates a ‘424 FAILED_DEPENDENCY’ result.

Attributes

Inherited from:
Results

Generates a ‘403 FORBIDDEN’ result.

Generates a ‘403 FORBIDDEN’ result.

Attributes

Inherited from:
Results
val GATEWAY_TIMEOUT: Int

Attributes

Inherited from:
Status
val GONE: Int

Attributes

Inherited from:
Status

Generates a ‘504 GATEWAY_TIMEOUT’ result.

Generates a ‘504 GATEWAY_TIMEOUT’ result.

Attributes

Inherited from:
Results
val Gone: Status

Generates a ‘410 GONE’ result.

Generates a ‘410 GONE’ result.

Attributes

Inherited from:
Results
val HOST: String

Attributes

Inherited from:
HeaderNames
val HTTP_1_0: String

Attributes

Inherited from:
HttpProtocol
val HTTP_1_1: String

Attributes

Inherited from:
HttpProtocol
val HTTP_2_0: String

Attributes

Inherited from:
HttpProtocol

Attributes

Inherited from:
Status

Generates a ‘505 HTTP_VERSION_NOT_SUPPORTED’ result.

Generates a ‘505 HTTP_VERSION_NOT_SUPPORTED’ result.

Attributes

Inherited from:
Results
val IF_MATCH: String

Attributes

Inherited from:
HeaderNames
val IF_MODIFIED_SINCE: String

Attributes

Inherited from:
HeaderNames
val IF_NONE_MATCH: String

Attributes

Inherited from:
HeaderNames
val IF_RANGE: String

Attributes

Inherited from:
HeaderNames
val IF_UNMODIFIED_SINCE: String

Attributes

Inherited from:
HeaderNames
val IM_A_TEAPOT: Int

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status

Generates a ‘418 IM_A_TEAPOT’ result.

Generates a ‘418 IM_A_TEAPOT’ result.

Attributes

Inherited from:
Results

Generates a ‘507 INSUFFICIENT_STORAGE’ result.

Generates a ‘507 INSUFFICIENT_STORAGE’ result.

Attributes

Inherited from:
Results

Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

Generates a ‘500 INTERNAL_SERVER_ERROR’ result.

Attributes

Inherited from:
Results
val JSON: String

Content-Type of json. This content type does not define a charset parameter.

Content-Type of json. This content type does not define a charset parameter.

Attributes

Inherited from:
ContentTypes
val LAST_MODIFIED: String

Attributes

Inherited from:
HeaderNames
val LENGTH_REQUIRED: Int

Attributes

Inherited from:
Status
val LOCATION: String

Attributes

Inherited from:
HeaderNames
val LOCKED: Int

Attributes

Inherited from:
Status
val Locked: Status

Generates a ‘423 LOCKED’ result.

Generates a ‘423 LOCKED’ result.

Attributes

Inherited from:
Results
val MAX_FORWARDS: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val MULTIPLE_CHOICES: Int

Attributes

Inherited from:
Status
val MULTI_STATUS: Int

Attributes

Inherited from:
Status

Generates a ‘405 METHOD_NOT_ALLOWED’ result.

Generates a ‘405 METHOD_NOT_ALLOWED’ result.

Attributes

Inherited from:
Results

Generates a ‘207 MULTI_STATUS’ result.

Generates a ‘207 MULTI_STATUS’ result.

Attributes

Inherited from:
Results

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val NOT_ACCEPTABLE: Int

Attributes

Inherited from:
Status
val NOT_FOUND: Int

Attributes

Inherited from:
Status
val NOT_IMPLEMENTED: Int

Attributes

Inherited from:
Status
val NOT_MODIFIED: Int

Attributes

Inherited from:
Status
val NO_CONTENT: Int

Attributes

Inherited from:
Status

Generates a ‘511 NETWORK_AUTHENTICATION_REQUIRED’ result.

Generates a ‘511 NETWORK_AUTHENTICATION_REQUIRED’ result.

Attributes

Inherited from:
Results

Generates a ‘204 NO_CONTENT’ result.

Generates a ‘204 NO_CONTENT’ result.

Attributes

Inherited from:
Results

Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

Generates a ‘203 NON_AUTHORITATIVE_INFORMATION’ result.

Attributes

Inherited from:
Results

Generates a ‘406 NOT_ACCEPTABLE’ result.

Generates a ‘406 NOT_ACCEPTABLE’ result.

Attributes

Inherited from:
Results

Generates a ‘404 NOT_FOUND’ result.

Generates a ‘404 NOT_FOUND’ result.

Attributes

Inherited from:
Results

Generates a ‘501 NOT_IMPLEMENTED’ result.

Generates a ‘501 NOT_IMPLEMENTED’ result.

Attributes

Inherited from:
Results

Generates a ‘304 NOT_MODIFIED’ result.

Generates a ‘304 NOT_MODIFIED’ result.

Attributes

Inherited from:
Results
val OK: Int

Attributes

Inherited from:
Status
val ORIGIN: String

Attributes

Inherited from:
HeaderNames
val Ok: Status

Generates a ‘200 OK’ result.

Generates a ‘200 OK’ result.

Attributes

Inherited from:
Results
val PARTIAL_CONTENT: Int

Attributes

Inherited from:
Status
val PAYMENT_REQUIRED: Int

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val PRAGMA: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val PROXY_AUTHENTICATE: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status
val PROXY_AUTHORIZATION: String

Attributes

Inherited from:
HeaderNames

Generates a ‘206 PARTIAL_CONTENT’ result.

Generates a ‘206 PARTIAL_CONTENT’ result.

Attributes

Inherited from:
Results

Generates a ‘402 PAYMENT_REQUIRED’ result.

Generates a ‘402 PAYMENT_REQUIRED’ result.

Attributes

Inherited from:
Results

Generates a ‘412 PRECONDITION_FAILED’ result.

Generates a ‘412 PRECONDITION_FAILED’ result.

Attributes

Inherited from:
Results

Generates a ‘428 PRECONDITION_REQUIRED’ result.

Generates a ‘428 PRECONDITION_REQUIRED’ result.

Attributes

Inherited from:
Results
val RANGE: String

Attributes

Inherited from:
HeaderNames
val REFERER: String

Attributes

Inherited from:
HeaderNames
val REFERRER_POLICY: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val REQUEST_TIMEOUT: Int

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val RESET_CONTENT: Int

Attributes

Inherited from:
Status
val RETRY_AFTER: String

Attributes

Inherited from:
HeaderNames

Generates a ‘431 REQUEST_HEADER_FIELDS_TOO_LARGE’ result.

Generates a ‘431 REQUEST_HEADER_FIELDS_TOO_LARGE’ result.

Attributes

Inherited from:
Results

Generates a ‘408 REQUEST_TIMEOUT’ result.

Generates a ‘408 REQUEST_TIMEOUT’ result.

Attributes

Inherited from:
Results

Generates a ‘205 RESET_CONTENT’ result.

Generates a ‘205 RESET_CONTENT’ result.

Attributes

Inherited from:
Results
val SEE_OTHER: Int

Attributes

Inherited from:
Status
val SERVER: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status
val SET_COOKIE2: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status

Generates a ‘503 SERVICE_UNAVAILABLE’ result.

Generates a ‘503 SERVICE_UNAVAILABLE’ result.

Attributes

Inherited from:
Results

Generates a ‘101 Switching Protocols’ result.

Generates a ‘101 Switching Protocols’ result.

Attributes

Inherited from:
Results
val TE: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
Status
lazy val TODO: Action[AnyContent]

Used to mark an action that is still not implemented, e.g.:

Used to mark an action that is still not implemented, e.g.:

 def action(query: String) = TODO

Attributes

Inherited from:
ControllerHelpers

Attributes

Inherited from:
Status
val TRAILER: String

Attributes

Inherited from:
HeaderNames
val TRANSFER_ENCODING: String

Attributes

Inherited from:
HeaderNames

Generates a ‘429 TOO_MANY_REQUESTS’ result.

Generates a ‘429 TOO_MANY_REQUESTS’ result.

Attributes

Inherited from:
Results
val UNAUTHORIZED: Int

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status

Attributes

Inherited from:
Status
val UPGRADE: String

Attributes

Inherited from:
HeaderNames
val UPGRADE_REQUIRED: Int

Attributes

Inherited from:
Status
val USER_AGENT: String

Attributes

Inherited from:
HeaderNames
val USE_PROXY: Int

Attributes

Inherited from:
Status

Generates a ‘401 UNAUTHORIZED’ result.

Generates a ‘401 UNAUTHORIZED’ result.

Attributes

Inherited from:
Results

Generates a ‘422 UNPROCESSABLE_ENTITY’ result.

Generates a ‘422 UNPROCESSABLE_ENTITY’ result.

Attributes

Inherited from:
Results

Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

Generates a ‘415 UNSUPPORTED_MEDIA_TYPE’ result.

Attributes

Inherited from:
Results

Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

Generates a ‘414 REQUEST_URI_TOO_LONG’ result.

Attributes

Inherited from:
Results
val VARY: String

Attributes

Inherited from:
HeaderNames
val VIA: String

Attributes

Inherited from:
HeaderNames
val WARNING: String

Attributes

Inherited from:
HeaderNames
val WWW_AUTHENTICATE: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames
val X_FORWARDED_FOR: String

Attributes

Inherited from:
HeaderNames
val X_FORWARDED_HOST: String

Attributes

Inherited from:
HeaderNames
val X_FORWARDED_PORT: String

Attributes

Inherited from:
HeaderNames
val X_FORWARDED_PROTO: String

Attributes

Inherited from:
HeaderNames
val X_FRAME_OPTIONS: String

Attributes

Inherited from:
HeaderNames

Attributes

Inherited from:
HeaderNames
val X_REQUESTED_WITH: String

Attributes

Inherited from:
HeaderNames
val X_XSS_PROTECTION: String

Attributes

Inherited from:
HeaderNames

Implicits

Inherited implicits

implicit lazy val defaultFormBinding: FormBinding

Attributes

Inherited from:
BaseControllerHelpers

The default FileMimeTypes provided by Play. Used to map between file name extensions and mime types.

The default FileMimeTypes provided by Play. Used to map between file name extensions and mime types.

Attributes

Inherited from:
BaseControllerHelpers
implicit def messagesApi: MessagesApi

The MessagesApi provided by Play. This can be used to provide the MessagesApi needed by play.api.i18n.I18nSupport.

The MessagesApi provided by Play. This can be used to provide the MessagesApi needed by play.api.i18n.I18nSupport.

Attributes

Inherited from:
BaseControllerHelpers
implicit def request2flash(implicit request: RequestHeader): Flash

Retrieve the flash scope implicitly from the request.

Retrieve the flash scope implicitly from the request.

For example:

def index(name:String) = Action { implicit request =>
 val message = request2flash("message")
 Ok("Got " + message)
}

Attributes

Inherited from:
RequestImplicits
implicit def request2session(implicit request: RequestHeader): Session

Retrieves the session implicitly from the request.

Retrieves the session implicitly from the request.

For example:

def index(name:String) = Action { implicit request =>
 val username = request2session("username")
 Ok("Hello " + username)
}

Attributes

Inherited from:
RequestImplicits
implicit def supportedLangs: Langs

The default Langs provided by Play. Can be used to determine the application's supported languages.

The default Langs provided by Play. Can be used to determine the application's supported languages.

Attributes

Inherited from:
BaseControllerHelpers