When using play-scala module, I write a Secure trait as the following:
trait Secure extends Controller {
self:Controller =>
@Before
def checkAccess = {
if (!session.contains("username")) {
flash.put("url", if (request.method == "GET") request.url else "/")
Action(Authentication.login)
}
var check = getActionAnnotation(classOf[Check])
if (check != null) {
check(check)
}
check = getControllerInheritedAnnotation(classOf[Check])
if (check != null) {
check(check)
}
}
private def check(check: Check) {
for (role <- check.value()) {
if (!check(role)) {
Forbidden
}
}
}
}
But I get the following compilation error:
The file /app/controllers/Secure.scala could not be compiled. Error raised is : not found: value getActionAnnotation
How can I correct this?