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 writingapply _
orapply(_)(_)
instead ofapply
.
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!
source to share
No one has answered this question yet
Check out similar questions: