I've created a WrappedRequest
class AuthenticatedRequest[A](login: LoginEntity, theme: Option[ThemeEntity], request: Request[A]) extends WrappedRequest[A](request)
I'd like to pass the request implicitly
def show = Auth { implicit request: AuthenticatedRequest =>
Ok(html.show("Greetings"))
}
to my template show.scala.html
@import controllers.actions.Authenticated.AuthenticatedRequest
@(greeting: String)(implicit request: AuthenticatedRequest[_])
But importing fails --
object Authenticated is not a member of package controllers.actions
[error] Note: trait Authenticated exists, but it has no companion object.
Authenticated trait is a trait that the Controller integrates
trait Authenticated { this: Controller => ...
Is what I'm trying to do possible? Looks like this post is relevant:
[companion objects] are important for the implicit resolution -- when looking for an implicit value of a certain type, the companion object of that type is inspected to see if there exists a corresponding implicit definition; see the exact rules of implicit resolution in the Scala specification or a short summary in this blog post