You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ja...@usitc.gov on 2006/09/14 20:44:50 UTC

Access Session-scoped ASO from HttpSessionListener

I know this has been discussed here recently, but I haven't really seen
a satisfactory conclusion yet.  Perhaps someone can clear this up for
me.
 
--- Our situation ---

We have a need to, upon session timeout, clean up a number of file
system resources that may have been created by the application user.
The (apparently) only available method to do this reliably is the
HttpSessionListener. 

In order to accurately locate these file system resources, we need to
retrieve a String value from a Session scoped ASO.  

I have seen the various methods to retrieve the Hivemind registry and
the ApplicationStateManager, however, I have run into a problem.  

--- The Problem ---

The ApplicationStateManager depends upon the SessionScopeManager for
session scoped ASOs.  The SessionScopeManager uses a WebSession object
to retrieve ASO objects for return.  

The problem here is that the SessionScopeManager depends on a WebRequest
being injected to retrieve the WebSession.  During execution of the
HttpSessionListener, no WebRequest is available, and as such the method
call to the SessionScopeManager to retrieve a session scoped ASO throws
a NullPointerException in getWebSession (at or about line 53).

--- The Question ---

Why does SessionScopeManager depend on the WebRequest to retrieve the
session?  What am I missing here, and what, if any, recourse to I have
to retrieve a session scoped ASO from withi the HttpSessionListener?

Grateful for any insight,

-jason

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Access Session-scoped ASO from HttpSessionListener

Posted by Shing Hing Man <ma...@yahoo.com>.

>The problem here is that the SessionScopeManager
depends on a 
>WebRequest
>being injected to retrieve the WebSession.  During
execution of the
>HttpSessionListener, no WebRequest is available, and
as such the method
>call to the SessionScopeManager to retrieve a session
scoped ASO throws
>a NullPointerException in getWebSession (at or about
line 53).

You might like to try manually  setting the  property 
'webRequest' in the 
 (the hivemind service) 
tapestry.globals.RequestGlobals.
The following post in the archive shows how to do it.

http://article.gmane.org/gmane.comp.java.tapestry.user/39168/match=shing

Shing



--- Jason.Yankus@usitc.gov wrote:

> 
> I know this has been discussed here recently, but I
> haven't really seen
> a satisfactory conclusion yet.  Perhaps someone can
> clear this up for
> me.
>  
> --- Our situation ---
> 
> We have a need to, upon session timeout, clean up a
> number of file
> system resources that may have been created by the
> application user.
> The (apparently) only available method to do this
> reliably is the
> HttpSessionListener. 
> 
> In order to accurately locate these file system
> resources, we need to
> retrieve a String value from a Session scoped ASO.  
> 
> I have seen the various methods to retrieve the
> Hivemind registry and
> the ApplicationStateManager, however, I have run
> into a problem.  
> 
> --- The Problem ---
> 
> The ApplicationStateManager depends upon the
> SessionScopeManager for
> session scoped ASOs.  The SessionScopeManager uses a
> WebSession object
> to retrieve ASO objects for return.  
> 
> The problem here is that the SessionScopeManager
> depends on a WebRequest
> being injected to retrieve the WebSession.  During
> execution of the
> HttpSessionListener, no WebRequest is available, and
> as such the method
> call to the SessionScopeManager to retrieve a
> session scoped ASO throws
> a NullPointerException in getWebSession (at or about
> line 53).
> 
> --- The Question ---
> 
> Why does SessionScopeManager depend on the
> WebRequest to retrieve the
> session?  What am I missing here, and what, if any,
> recourse to I have
> to retrieve a session scoped ASO from withi the
> HttpSessionListener?
> 
> Grateful for any insight,
> 
> -jason
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Home page :
  http://uk.geocities.com/matmsh/index.html


		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org