An EssentialAction is a function that takes the request headers and gives an Iteratee that will eventually parse the request body and produce a HTTP result. Action[A] implements EssentialAction as follow: it parses the request body using its body parser, gives the built Request[A] object to the action code and returns the action code’s result. An Action[A] can still be thought of as a Request[A] => Result function because it has an apply(request: Request[A]): Result method.

The EssentialAction trait is useful to compose actions with code that requires to read some information from the request headers before parsing the request body.

Our Authenticated implementation above tries to find a user id in the request session and calls the wrapped action with this user if found, otherwise it returns a 401 UNAUTHORIZED status without even parsing the request body.