Composing with Play's EssentialAction
I'm using Play 2.2.1 and I'm trying to write my own Action to deal with CORS requests. I found this but unfortunately it doesn't compile. Just for reference here's the (slightly modified) code: import play.api.mvc._ import scala.concurrent.ExecutionContext case class CorsAction(action: EssentialAction) extends EssentialAction { def apply(request: RequestHeader) = { implicit val executionContext: ExecutionContext = play.api.libs.concurrent.Execution.defaultContext val origin = request.headers.get("Origin").getOrElse("*") if (request.method == "OPTIONS") { val cors = Action { request => Ok("")