I have an application using the isAuthenticated template described in the zentasks example. It also uses Future / Async to minimize blocking ...
def index = isAuthenticated { username => implicit request => val promise = Future { Foo.all() } Async { promise.map(f => Ok(views.html.foo.index(username, f))) } }
This continues to work in Play 2.2.0, but the Future / Async pattern is deprecated. We must use Action.async; something like:
def asyncTest = Action.async { val fut = Future { // Artificial delay to test. Thread.sleep(5000) "McFly" } fut.map (f => Ok(f)) }
My question is: how can I use Action.async with the above authentication method or something like that?
seand
source share