Question

I want to create controller method and parametrize it with Class parameter to call it in routes:

GET     /api/res1           controllers.GenericController.index(clazz:Class = Res1.class)
GET     /api/res2           controllers.GenericController.index(clazz:Class = Res2.class)

and during compilation play shouts:

[error] /home/../workspace/repo/prototype/conf/routes:26: identifier expected but 'class' found.
[error] /home/../workspace/repo/prototype/conf/routes:26: ')' expected but '}' found.

why '}' ? and how to make my idea work?

Was it helpful?

Solution

Try changing to this:

/api/res1   controllers.GenericController.index(clazz: Class[_] = classOf[full.package.name.Res1])

Works just fine for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top