Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use `controllers.Default.redirect` in Play 2.4 and `InjectedRoutesGenerator`

If I try to use controllers.Default.redirect(to = "/foo/bar") in my routes file with routesGenerator := InjectedRoutesGenerator enabled in my build.sbt file, I get the compilation error

type Default is not a member of package controllers

With this new injected routes feature in Play 2.4 is there still a way to use handlers defined in static objects?

like image 360
metasim Avatar asked Jun 08 '15 18:06

metasim


1 Answers

No there's not. Default should be made a class so it can be used from an injected router, with a companion object that extends it so it can still be used from the static router. Please raise an issue in the Play issue tracker, or better, submit a pull request to fix this.

like image 74
James Roper Avatar answered Oct 10 '22 14:10

James Roper