Compose action (BodyParser) with ActionFilter in scala game framework

I have a gaming platform app and a problematic action. I am trying to parse a request body with parse.form

and then run ActionFilter

against that parsed body.

So far I have something like this

object ModelValidationAction extends ActionFilter[Request[MyModel]]{
  def filter[A <: MyModel](request: Request[A]) = ???
}

def routePointsHere = (Action(parse.form(myModelForm)) andThen ModelValidationAction) { (request: Request[MyModel]) => ??? }

      

however IDEA gives me an error hint

Expected Action [MyModel] => NotInferredA, actual ModelValidationAction.type

and the compiler tells me

... the list of missing arguments for the method applies in the ActionBuilder
[error] flag . Non-applicable methods are only converted to functions when the type of the function is expected. [error] You can make this conversion explicit by writing apply _

or apply(_)(_)

instead of apply

.

So, I can figure out that the problem lies in the method apply[A](bodyParser: BodyParser[A])(block: R[A] => Result): Action[A]

around the fact that this second parameter list is not populating, but I don't know exactly how the language behaves here.

My (completely unfounded) assumption is what Action(parse.form(myModelForm))

will become Request[MyModel] => Result

and the call andThen

will return the same.

Any pointers to what I'm missing? Thank!

+3


source to share





All Articles