alekperos
alekperos

Reputation: 576

@After annotation doesn't work with parameters in Play! Framework with Scala module

I'm encountering a problem with interceptors in Play! Framework (1.2.3) with Scala module (0.9.1).

I have a following code which should run whenSuccess method after invocation of 'index' method, but it doesn't happen.

@After(only=Array("index")) def whenSuccess = {println("I'm a hero")  }

def index={
     Html('Hello world')
 }

 def returnXML = {
     Xml("<helloinfo>Hello world in XML</helloinfo>")
 }
 ...

whenSuccess is not invoked when i specify 'only' parameter. without any param it works, but i want to restrict it to happen only when 'index' method fired.

May be I'm doing something wrong?

Many thanks for advises!!!

Upvotes: 2

Views: 371

Answers (1)

Marius Soutier
Marius Soutier

Reputation: 11274

@After doesn't seem to work at all (@Before works, though). I found this ticket with an open pull-request: https://play.lighthouseapp.com/projects/74274/tickets/24-after-controller-interceptor-doesnt-work Milestone is set to 0.9.2.

Upvotes: 1

Related Questions