开发者

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

开发者 https://www.devze.com 2023-04-10 22:45 出处:网络
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, b

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 somet开发者_StackOverflowhing wrong?

Many thanks for advises!!!


@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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号