works like a charm thanks! Karthik
On 1/4/07, Jeff Lubetkin <[EMAIL PROTECTED]> wrote:
This is because ApplicationStateManager requires that the WebRequest in RequestGlobals is set, but it doesn't normally get set until the terminator of the filter chain. In order to get around this, I usually inject the RequestGlobals service into my filter and add these lines at the beginning of the service method: if ( requestGlobals.getWebRequest() == null ) requestGlobals.store( request, response ); Hope this helps, jeff -----Original Message----- From: karthik G [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 03, 2007 8:40 PM To: Tapestry users Subject: Error when accessing ApplicationStateManager in WebRequestServicerFilter I wrote my custom filter that implements WebRequestServicerFilter - In my filter am looking up ApplicationStatemanager to determine if a session object exists. <service-point id="CustomServicerFilter" interface=" org.apache.tapestry.services.WebRequestServicerFilter"> <invoke-factory> <construct class=" com.sgt.framework.tapestry.CustomWebRequestServicerFilter"> <set-object property="applicationStateManager" value="service:tapestry.state.ApplicationStateManager"/> </construct> </invoke-factory> </service-point> <contribution configuration-id=" tapestry.request.WebRequestServicerPipeline"> <filter name="CustomServicerFilter" object="service:CustomServicerFilter" /> </contribution> public class CustomWebRequestServicerFilter implements WebRequestServicerFilter { public void service(WebRequest request, WebResponse response, WebRequestServicer servicer) throws IOException { if (applicationStateManager != null){ log.debug("\n\n+++++++ User object exists? --> " + applicationStateManager.exists("user")); ......(1) } } I get an error at line 1 when i invoke the 'exists( )' method. java.lang.NullPointerException: Property 'webRequest' of <OuterProxy for tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlob als)> is null. at $WebRequest_10feb506bfc._targetServiceProperty($WebRequest_10feb506bfc.j ava) at $WebRequest_10feb506bfc.getSession($WebRequest_10feb506bfc.java) at $WebRequest_10feb506bba.getSession($WebRequest_10feb506bba.java) at $WebRequest_10feb506bb9.getSession($WebRequest_10feb506bb9.java) at org.apache.tapestry.engine.state.SessionScopeManager.exists( SessionScopeManager.java:53) at $StateObjectPersistenceManager_10feb506bfb.exists($StateObjectPersistenc eManager_10feb506bfb.java) at $StateObjectPersistenceManager_10feb506bfa.exists($StateObjectPersistenc eManager_10feb506bfa.java) at org.apache.tapestry.engine.state.StateObjectManagerImpl.exists( StateObjectManagerImpl.java:45) at org.apache.tapestry.engine.state.ApplicationStateManagerImpl.exists( ApplicationStateManagerImpl.java:51) at $ApplicationStateManager_10feb506b8f.exists($ApplicationStateManager_10f eb506b8f.java) at $ApplicationStateManager_10feb506b90.exists($ApplicationStateManager_10f eb506b90.java) at com.xyz.framework.tapestry.CustomWebRequestServicerFilter.service( CustomWebRequestServicerFilter.java:73) I just want to look up a session object. I realize that i have access to WebRequest and from there i can get to HttpSession and do a attribute name look up. But I think that would amount to by-passing tapestry. moreover I dont know the *exact* key that tapestry uses to store the object in session (the ones i inject through @InjectState). thanks, Karthik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]