0

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

Community
  • 1
  • 1
tgk
  • 3,857
  • 2
  • 27
  • 42
  • 1
    Where is defined `AuthenticatedRequest`, inside the trait? If yes, the template cannot use it for me – cchantep Apr 26 '16 at 07:24
  • thanks -- yeah the AuthenticatedRequest is defined inside of the Authenticated trait. – tgk Apr 26 '16 at 15:21

0 Answers0