Default

play.api.mvc.BodyParsers.Default
class Default(parse: PlayBodyParsers) extends BodyParser[AnyContent]

The default body parser provided by Play

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Constructors

An alternate constructor primarily designed for unit testing. Default values are set to empty or singleton implementations where appropriate.

An alternate constructor primarily designed for unit testing. Default values are set to empty or singleton implementations where appropriate.

Attributes

Concrete methods

Attributes

Definition Classes

Inherited methods

Attributes

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

Attributes

Inherited from:
Function1
def map[B](f: AnyContent => B)(implicit ec: ExecutionContext): BodyParser[B]

Uses the provided function to transform the BodyParser's computed result when the request body has been parsed.

Uses the provided function to transform the BodyParser's computed result when the request body has been parsed.

Value parameters

ec

The context to execute the supplied function with. The context is prepared on the calling thread.

f

a function for transforming the computed result

Attributes

Returns

the transformed body parser

See also

play.api.libs.streams.Accumulator.map

Inherited from:
BodyParser
def mapM[B](f: AnyContent => Future[B])(implicit ec: ExecutionContext): BodyParser[B]

Like map but allows the map function to execute asynchronously.

Like map but allows the map function to execute asynchronously.

Value parameters

ec

The context to execute the supplied function with. The context prepared on the calling thread.

f

the async function to map the result of the body parser

Attributes

Returns

the transformed body parser

See also

map

play.api.libs.streams.Accumulator.mapFuture[B]

Inherited from:
BodyParser
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 from:
Function1
def validate[B](f: AnyContent => Either[Result, B])(implicit ec: ExecutionContext): BodyParser[B]

Uses the provided function to validate the BodyParser's computed result when the request body has been parsed.

Uses the provided function to validate the BodyParser's computed result when the request body has been parsed.

The provided function can produce either a direct result, which will short circuit any further Action, or a value of type B.

Example:

 def validateJson[A : Reads] = parse.json.validate(
   _.validate[A].asEither.left.map(e => BadRequest(JsError.toJson(e)))
 )

Value parameters

ec

The context to execute the supplied function with. The context is prepared on the calling thread.

f

the function to validate the computed result of this body parser

Attributes

Returns

the transformed body parser

Inherited from:
BodyParser
def validateM[B](f: AnyContent => Future[Either[Result, B]])(implicit ec: ExecutionContext): BodyParser[B]

Like validate but allows the validate function to execute asynchronously.

Like validate but allows the validate function to execute asynchronously.

Value parameters

ec

The context to execute the supplied function with. The context is prepared on the calling thread.

f

the async function to validate the computed result of this body parser

Attributes

Returns

the transformed body parser

See also
Inherited from:
BodyParser