Component instantiation is handled by the underlying component framework, Avalon. What you would like to do is _might_ be possible by mucking with Avalon (ComponentHandlers and such) but there must be an easier way. For example, your Action could use the Session object to keep an Object of your choice to handle the per-session functionality you want. You get the Session from the objectModel Map object passed in the act() method:

HttpSession session = ObjectModelHelper.getRequest(objectModel).getSession();
MySessionObject obj = (MySessionObject) session.getAttribute("mySessionObj");
if ( null == obj )
   obj = new MySessionObject();
   session.setAttribute("mySessionObj", obj);
}


Charles





vupt vupt wrote:


Hi,

I am hoping someone can help me with this. I have created an Action and would like an instance of that Action to be instantiated for each new session that uses the Action.

For example, take this snippet from my sitemap.

<map:components>
  <map:actions>
       <map:action name="JukeBoxAction" src="test.JukeBoxAction"/>
   </map:actions>
</map:components>

<map:pipeline>
<map:match pattern="jukeBox/jukeBox.xmap">
<map:act type="JukeBoxAction">
<map:generate src="xmlAction/xmlAction.xsp" type="serverpages"/>
<map:transform src="jukeBox/jukeBox.xsl"/>
<map:serialize type="html"/>
</map:act>
</map:match>
</map:pipeline>



I would like an instance of JukeBoxAction to be created for each person or session that matches the above pattern.


The behaviour right now is that one instance of the JukeBoxAction object is created and multiple sessions access the same object instance.

I would like each session to create and use its own JukeBoxAction instance.

Any help with this problem would be most appreciated.
Thanks.




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



Reply via email to