1
下面的控制器操作導致錯誤:斯卡拉播放Action.async不能化解好爲mvc.AnyContent
(block: => scala.concurrent.Future[play.api.mvc.SimpleResult])play.api.mvc.Action[play.api.mvc.AnyContent] cannot be applied to (scala.concurrent.Future[Object])".
每未來幾年內的行動應該OK(),所以我不明白爲什麼斯卡拉着決心期貨正確。
def form = Action.async {
val checkSetup: Future[Response] = EsClient.execute(new IndexExistsQuery("fbl_indices"))
checkSetup map {
case result if result.status == 200 => Ok("form")
case result => {
val createIndexResult: Future[Response] = EsClient.execute(new FillableSetupQuery())
createIndexResult map {
indexCreated => Ok("form").flashing("success" -> "alles tutti")
} recover {
case e: Throwable => Ok("form error").flashing("message" -> "error indexerzeugung")
}
}
} recover {
case e: Throwable => Ok("form error").flashing("message" -> "error index query")
}
}
完全ERRORMSG:
overloaded method value async with alternatives: [A](bodyParser: play.api.mvc.BodyParser[A])(block: play.api.mvc.Request[A] => scala.concurrent.Future[play.api.mvc.SimpleResult])play.api.mvc.Action[A] <and> (block: play.api.mvc.Request[play.api.mvc.AnyContent] => scala.concurrent.Future[play.api.mvc.SimpleResult])play.api.mvc.Action[play.api.mvc.AnyContent] <and> (block: => scala.concurrent.Future[play.api.mvc.SimpleResult])play.api.mvc.Action[play.api.mvc.AnyContent] cannot be applied to (scala.concurrent.Future[Object])