Leon Rosenberg wrote:
The question is now, how can I ensure, that an action is actually createdI think I just had multiple tiny aneurysms. Can't you just say "Uh... could you, like, not instantiate this?"
once, and from proper "caller" without changing 500 existing action classes.
The only thing I could imagine, would be introducing a test mode, and if
running in test mode, throw an exception in the BaseAction (mother of all
actions) constructor, parsing the stackTrace, whether the struts request
processor was the caller of the constructor and deny the creation otherwise.
Not very elegant, isn't it?
What if you subclassed the request processor and used it to create an app-scope hashmap of instantiated actions, then in the base action class check to see if the action was created via the request processor by checking the hash? So if somebody instantiates outside of the request processor it'll see "Oh, no entry in the hash map, can't instantiate."
If it DOES see an entry, it means it's already been instantiated by the request processor, so it's either a rogue instantiation (um... the request processor only creates an action once, right? I might be talking out something besides my mouth here) or somebody is trying to instantiate it when they shouldn't be, and the monitor-mounted slapping monkey whaps 'em a good one.
Dave
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]