2
我的問題是SimpleResult似乎不允許讀訪問其會話,只能寫訪問(withSession)。Play for Scala:在ActionBuilder中,是否可以修改包裝動作結果的會話?
object MyAction extends ActionBuilder[MyRequest] {
def invokeBlock[A](
request: Request[A],
block: (MyRequest[A]) => Future[SimpleResult]
): Future[SimpleResult] = {
// do stuff, create x, y
val resultFuture = block(MyRequest(x, y, request)
// Now I want to modify resultFuture's session,
// keeping any changes block might have done to request.session.
// And I'd rather not parse result's headers by hand to do that.
}
}
我錯過了什麼?