Re: Question on Application, Session, Request Awareness best practices ...

2008-01-16 Thread Dave Newton
Hmm, did you ask this question last week? Or did someone else ask almost the
exact same thing?

--- Mufaddal Khumri [EMAIL PROTECTED] wrote:
 Since struts2 actions are not shared amongst requests and if these  
 actions are Aware of one of the scopes they essentially have a copy  
 of that scope's parameters in a map.

No, they have a *reference* to the parameters, not a copy.

 Que1. When you add a new application attribute, does it automatically  
 get added to all the present maps of that particular scope in all the  
 instances of a particular action that are ApplicationAware?

Application scope is application scope: if you add something to the
application scope then anything else that has a reference to the application
scope has access to what you added. Good luck synchronizing that.

 Que2. What are the performance implications of having such a map on  
 each application instance that requires access to a particular  
 application scoped attribute and not all?

Essentially none. All the interceptor does is check if an action implements
an *Aware interface and, if it does, sets the appropriate map by calling the
matching setter method.

 Que3. If an action needs just one application attribute, is it better  
 to have an interceptor extract that from the application scope and  
 set it on the action?

No. That would take longer, be more convoluted, and require more
configuration.

 Que4. Is it better to implement the Awareness of one or more of the  
 scope in an interceptor ? (Since interceptor instances are shared  
 across requests) If yes, would this map of attributes from the  
 particular scope get updated when a new attribute is added to that  
 particular scope?

I'm not even sure what you mean by that; what good would having the values in
the interceptor do for your action?

d.


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



Question on Application, Session, Request Awareness best practices ...

2008-01-15 Thread Mufaddal Khumri

Hello,

Since struts2 actions are not shared amongst requests and if these  
actions are Aware of one of the scopes they essentially have a copy  
of that scope's parameters in a map. Lets say the application has  
about 15 attributes and the session has about 7 attributes.


Que1. When you add a new application attribute, does it automatically  
get added to all the present maps of that particular scope in all the  
instances of a particular action that are ApplicationAware?


Que2. What are the performance implications of having such a map on  
each application instance that requires access to a particular  
application scoped attribute and not all?


Que3. If an action needs just one application attribute, is it better  
to have an interceptor extract that from the application scope and  
set it on the action?


Que4. Is it better to implement the Awareness of one or more of the  
scope in an interceptor ? (Since interceptor instances are shared  
across requests) If yes, would this map of attributes from the  
particular scope get updated when a new attribute is added to that  
particular scope?


Thanks.


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