Marco
Marco

Reputation: 15929

How to execute code after response has been sent?

I have a need in which i want to execute some code after the rendering process has been finished. I tried the afterView filter but this does not take into account the use of layouts.

How can i execute some code after the view has been rendered? (example programmatical logout code)

Upvotes: 2

Views: 437

Answers (3)

Igor Artamonov
Igor Artamonov

Reputation: 35951

You can still use standard Java EE filter: http://docs.oracle.com/javaee/5/api/javax/servlet/Filter.html and put it into grails by using webxml plugin: http://www.grails.org/plugin/webxml

Upvotes: 1

Bagira
Bagira

Reputation: 2243

I suppose what need is afterInterceptor. This is called after you have executed render statement from your controller action.

Hope that helps.

Upvotes: 0

Philippe
Philippe

Reputation: 6828

On the rendered view, add an onload hook to post an ajax call to your logout controller/action.

Upvotes: 0

Related Questions