玩! 2.1将请求传递给另一个Scala控制器

时间:2013-05-22 21:38:58

标签: scala playframework-2.1

因为在Play中已弃用routeAndCall(特定于Java)等API! 2.1,如何将请求传递给Scala中的另一个控制器?

类似的东西:

def this = Action { implicit request =>
  if(request.body) routeAndCall(controller.App.methodWithPostBody)
  else Ok("hello")
}

谢谢!

2 个答案:

答案 0 :(得分:1)

routeAndCall方法已弃用的注释提示改为使用route方法:

@deprecated("Use route instead.", "2.1.0")

答案 1 :(得分:0)

你的用例是什么?你可以使用客户端重定向吗?不推荐使用此方法:如果应用程序在服务器端执行重定向,则客户端将不知道重定向。