2

I'd like to time an upload. Therefore, I'd like to know when a socket connection started for the request, and when it ended.

I looked at the beforeInterceptor and afterInterceptor, but I'm under the impression that these are only fired after the whole request is complete, but before and after the action has been processed.

Looking forward to hearing your insights...

sparkyspider
  • 13,195
  • 10
  • 89
  • 133
  • Do you use any frontend, like Nginx, in front of your app? – Igor Artamonov Apr 26 '13 at 12:35
  • Maybe with AOP? Related Spring question: http://stackoverflow.com/questions/4428521/measuring-method-execution-time-for-a-java-web-service-in-a-production-environme –  Apr 26 '13 at 23:52

1 Answers1

1

I think the closest you can get would be to use a filter where you can capture the request using before & afterView.

http://grails.org/doc/latest/guide/theWebLayer.html#filterTypes

If you have multiple filters that are significantly expensive, you can dependsOn to control the order of filter execution.

http://grails.org/doc/latest/guide/theWebLayer.html#filterDependencies

Ben W.
  • 381
  • 3
  • 6
  • If you are like me and render content directly in the view (ie. lots of JSON), the "after" filter type will be useful also. – EpicVoyage Jan 29 '14 at 14:13