添加WrappedRequest来玩!模板为隐式(隐式解析失败?)

时间:2016-04-26 01:44:40

标签: scala playframework

我创建了一个WrappedRequest

 class AuthenticatedRequest[A](login: LoginEntity, theme: Option[ThemeEntity], request: Request[A]) extends WrappedRequest[A](request)

我想隐含地传递请求

 def show = Auth { implicit request: AuthenticatedRequest => 
   Ok(html.show("Greetings"))
 }

到我的模板show.scala.html

@import controllers.actions.Authenticated.AuthenticatedRequest

@(greeting: String)(implicit request: AuthenticatedRequest[_])

但导入失败 -

object Authenticated is not a member of package controllers.actions
[error] Note: trait Authenticated exists, but it has no companion object.

经过身份验证的特征是Controller集成的特征

trait Authenticated { this: Controller => ... 

我正在尝试做什么?看起来this post是相关的:

  

[伴侣对象]对于隐式解析很重要 - 何时   寻找某个类型的隐含值,即伴随对象   检查该类型是否存在相应的   隐含定义;看到隐含分辨率的确切规则   Scala规范或此博客文章中的简短摘要

0 个答案:

没有答案