Thanx Dave, 

You message just brought the answer :-) 
As I read "HashMap" I remembered that I actually do have a HashMap in the
ActionRegistry, where each action is 
registered in BaseActions constructor, so I can collect actionstats (number
of requests, min/max/middle times etc) for 
later presentation. Actually the registry only allows one action to be
registered once, this is how I found out, that 
someone instantiated an action directly, there was an action in stats
overview with zero requests to it, because execute
was never called on this instance.
Now all I have to do, is to throw an Exception instead of log.warn in the
ActionRegistry to a special log file, and check this log file 
after 30 minutes (by then normally all actions are called at least once).
Thanx again :-)

Leon 

> -----Ursprüngliche Nachricht-----
> Von: Dave Newton [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 31. März 2005 00:45
> An: Struts Users Mailing List
> Betreff: Re: How to protect an action from the "user"
> 
> Leon Rosenberg wrote:
> 
> >The question is now, how can I ensure, that an action is actually 
> >created 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? 
> >  
> >
> I think I just had multiple tiny aneurysms. Can't you just say "Uh... 
> could you, like, not instantiate this?"
> 
> 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]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to