Hi,

You could do something like this:

((ApplicationStateManager) ((Registry)
context.getAttribute("org.apache.tapestry.Registry:app")).getService(App
licationStateManager.class)).get("myStateObject");

Where "myStateObject" is the name of your ASO.

HTH

Ben

-----Original Message-----
From: Tapestry User List [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 04, 2007 8:45 AM
To: tapestry-user@jakarta.apache.org
Subject: how to retrieve an Application State Object (ASO) with an
application scope from the ServletContext ?

Hi,

Happy new year !!!!

I have created a class that implements ServletContextListener.
In the method public void contextDestroyed(ServletContextEvent event),
I need to retrieve an Application State Object (ASO) of tapestry 4
with an application scope (not session).

My question is how to retrieve an Application State Object (ASO) from
the ServletContext ?


public void contextDestroyed(ServletContextEvent event) {
      ServletContext context = event.getServletContext();
      // retrieve myApplicationObject here
}

In hivemodule.xml:
...
<contribution configuration-id="tapestry.state.ApplicationObjects">
                <state-object name="myApplicationObject"
scope="application">
                        <create-instance
class="ns.MyApplicationObject"/>
                </state-object>                 
</contribution>
...

Thanks so much,

D.

---------------------------------------------------------------------
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