aspose file tools*
The moose likes Struts and the fly likes Ideas Needed to insert Action execution time in DB !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Ideas Needed to insert Action execution time in DB !!" Watch "Ideas Needed to insert Action execution time in DB !!" New topic
Author

Ideas Needed to insert Action execution time in DB !!

Giri rangaraju
Greenhorn

Joined: Feb 19, 2009
Posts: 7
I briefly explain here my requirement
After sending the response from my application i need to insert the Total action execution time along with some request parameters in DB i do so because Sending the response and insertion in DB should be asynchronous.

1. With the below code i am able to get the action execution time and the parameters passed to it.
How to fetch value of a variable which i have assigned in my action class ??

2. Timer interceptor just logs the time taken by the action is it possible to assign the Timetaken value to a variable ??



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Getting an arbitrary property from an arbitrary action isn't possible without reflection, as far as I know. You have to know what methods you can call on an action in order to do it without reflection.

If you're always getting the *same* property from actions then you can create an interface with a getter for that property and have your actions implement that interface. The interceptor would then cast the action to that interface and call interface methods.

I suppose you could create an interface that returns a map, and set named properties in that map from within the action, if you need it to be totally general-purpose, but that entails more busywork in the actions.

Using a reflection helper could probably reduce the clutter in the interceptor to a line or two, I guess.

(Not very organized, but those are my initial thoughts :)
 
 
subject: Ideas Needed to insert Action execution time in DB !!