views:

26

answers:

1

I'm using Struts 2 and I'd like to determine the page generation time without an external profiler. I can easily profile the actions execute() method, but I don't know how to include the time spent before (in dispatchers, interceptors...) and after (time taken by the servlet corresponding to the view ("jsp time")).

Is there simple way to do this ? And if there isn't, how could I, at least, profile the "jsp time" (maybe a tag I'm not aware of ?) ? I think it would be accurate enough to just take in account action time + jsp time.

Thanks.

+1  A: 

You could use Filters before and after the call to get the time when the request comes in and the response goes out. No profiler needed. And you can configure the Filters in your web.xml to apply to particular URLs.

It's coarse-grained but effective.

duffymo
Thanks, I didn't know about filters so i found this: http://bit.ly/F6Ylx But how can I modify the response in the filter, to display the time in the generated page ?
Samuel_xL
I would image that you'd rather persist these rather than show them on the page.
duffymo
implemented and working, thanks
Samuel_xL