[英]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 如果我尝试在我的
build.sbt
文件中启用routesGenerator := InjectedRoutesGenerator
routes
文件中使用controllers.Default.redirect(to = "/foo/bar")
,则出现编译错误
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? 借助Play 2.4中的这一新的注入路由功能,还有使用静态对象中定义的处理程序的方法吗?
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.
请在Play问题追踪器中提出问题,或者更好的是,提交拉动请求以解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.