mardi 15 décembre 2015

Scala backticks in Play Framework Routes

I am using Ember.js and Play for a single page web app with Play as the API. Ember coalesces requests like this, ?ids[]=401460&ids[]=379610. But when I try handle that value in Play's routes file it is literally expecting the value as ids[] instead of ids. But I can't tell the routes file to look for ids[] because it throws errors on [. I have tried using back ticks like I would in scala code itself `ids[]` but that again throws errors in the routes file.

Is it possible to do this in the routes file?

GET /api/test      controllers.application.getTests(ids[]:List[Long]) 

I know I can manage it this way,

 Map<String,String[]> params = request().body().asFormUrlEncoded();

But I would prefer to just let Play do its thing and handle it in the routes file then hand the value off.

Is this at all possible or are the only options to handle it using asFormUrlEncoded?




Aucun commentaire:

Enregistrer un commentaire