Get the execution context to run the request in.
Get the execution context to run the request in.
The execution context
Invoke the block.
Invoke the block. This is the main method that an ActionBuilder has to implement, at this stage it can wrap it in any other actions, modify the request object or potentially use a different class to represent the request.
The request
The block of code to invoke
A future of the result
The BodyParser to be used by this ActionBuilder if no other is specified
Compose this ActionFunction with another, with this one applied first.
Compose this ActionFunction with another, with this one applied first.
ActionFunction with which to compose
The new ActionFunction
Constructs an Action
with default content, and no request parameter.
Constructs an Action
with default content, and no request parameter.
For example:
val hello = Action { Ok("Hello!") }
the action code
an action
Constructs an Action
with default content.
Constructs an Action
with default content.
For example:
val echo = Action { request => Ok("Got request [" + request + "]") }
the action code
an action
Constructs an ActionBuilder with the given BodyParser.
Constructs an ActionBuilder with the given BodyParser. The result can then be applied directly to a block.
For example:
val echo = Action(parse.anyContent) { request => Ok("Got request [" + request + "]") }
the type of the request body
the BodyParser
to use to parse the request body
an action
Constructs an Action
that returns a future of a result, with default content.
Constructs an Action
that returns a future of a result, with default content.
For example:
val hello = Action.async { request => ws.url(request.getQueryString("url").get).get().map { r => if (r.status == 200) Ok("The website is up") else NotFound("The website is down") } }
the action code
an action
Constructs an Action
that returns a future of a result, with default content.
Constructs an Action
that returns a future of a result, with default content.
For example:
val hello = Action.async { request => ws.url(request.getQueryString("url").get).get().map { r => if (r.status == 200) Ok("The website is up") else NotFound("The website is down") } }
the action code
an action
Constructs an Action
that returns a future of a result, with default content, and no request parameter.
Constructs an Action
that returns a future of a result, with default content, and no request parameter.
For example:
val hello = Action.async { ws.url("http://www.playframework.com").get().map { r => if (r.status == 200) Ok("The website is up") else NotFound("The website is down") } }
the action code
an action
Compose another ActionFunction with this one, with this one applied last.
Compose another ActionFunction with this one, with this one applied last.
ActionFunction with which to compose
The new ActionFunction
Compose the action with other actions.
Compose the action with other actions. This allows mixing in of various actions together.
The action to compose
The composed action
Compose the parser.
Compose the parser. This allows the action builder to potentially intercept requests before they are parsed.
The body parser to compose
The composed body parser
This trait is an ActionBuilder that provides a MessagesRequest to the block:
This is useful when you don't want to have to add play.api.i18n.I18nSupport to a controller for form processing.