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.RequestGlobals)>
is null.
   at
$WebRequest_10feb506bfc._targetServiceProperty($WebRequest_10feb506bfc.java)
   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($StateObjectPersistenceManager_10feb506bfb.java)
   at
$StateObjectPersistenceManager_10feb506bfa.exists($StateObjectPersistenceManager_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_10feb506b8f.java)
   at
$ApplicationStateManager_10feb506b90.exists($ApplicationStateManager_10feb506b90.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

Reply via email to