Action

play.api.mvc.Action
trait Action[A] extends EssentialAction

An action is essentially a (Request[A] => Result) function that handles a request and generates a result to be sent to the client.

For example,

val echo = Action { request =>
 Ok("Got request [" + request + "]")
}

Type parameters

A

the type of the request body

Attributes

Graph
Supertypes
trait Handler
class Object
trait Matchable
class Any
Show all
Known subtypes
class JavaAction

Members list

Type members

Types

type BODY_CONTENT = A

Type of the request body.

Type of the request body.

Attributes

Value members

Abstract methods

def apply(request: Request[A]): Future[Result]

Invokes this action.

Invokes this action.

Value parameters

request

the incoming HTTP request

Attributes

Returns

the result to be sent to the client

Attributes

Returns

The execution context to run the action in

def parser: BodyParser[A]

Body parser associated with this action.

Body parser associated with this action.

Attributes

Concrete methods

override def apply(): Action[A]

Attributes

Returns

itself, for better support in the routes file.

Definition Classes
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any

Inherited methods

def andThen[A](g: Accumulator[ByteString, Result] => A): T1 => A

Attributes

Inherited from:
Function1
def asJava: EssentialAction

Attributes

Inherited from:
EssentialAction
def compose[A](g: A => RequestHeader): A => R

Attributes

Inherited from:
Function1