You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "James A. Hillyerd" <ja...@hillyerd.com> on 2002/10/02 21:51:32 UTC

Session management for cached resources

Hi all,

The Husted.com Struts Catalog mentions a technique for providing session
management for cached resources (a Resource Cache):

"Most Web applications require use of a workflow, and need to save
ActionForms and other attributes for future use. These items may also
need to be released in a block when the workflow completes. A convenient
way to handle this is to define a "Resource Cache". This can simply be a
hash map that uses a wrapper object to manage its items. The wrapper
object can include a named "scope", a property to indicate whether the
item is permanent or temporary, and a counter. To keep the cache
manageable, a threshold can be set, and the oldest temporary items
removed when the threshold is reached and a new item needs to be added."

( from http://husted.com/struts/catalog.html )

I can't find any information in the archives or online about
implementing something like this.  It seems like it would be difficult
to integrate with struts. How would struts handle having it's form beans
nested within this "Resource Cache" object?

Thanks.

-james

-- 
[]  James A. Hillyerd <ja...@hillyerd.com> - Java Software Engineer
[]  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Session management for cached resources

Posted by Andrew Hill <an...@gridnode.com>.
Im running 1.1, so in your case, running 1.0 you would need to make changes
in the ActionServlet, as afaik the RequestProcessor is a 1.1 thing.

-----Original Message-----
From: James A. Hillyerd [mailto:james@hillyerd.com]
Sent: Saturday, October 05, 2002 01:21
To: andrew.david.hill@gridnode.com
Cc: Struts Users Mailing List
Subject: RE: Session management for cached resources


On Wed, 2002-10-02 at 19:14, Andrew Hill wrote:
> Im doing something rather like this, only I called it an
"OperationContext"
> which comprises a hashtable of attributes and an id to store it under in
the
> session (passed in the request). I simply overrode the RequestProcessor so
> it knew to look for an actionform in the OperationContext first if the
form
> scope is session.
> Works quite nicely.

That sounds pretty close to what I want to do.  Which version of Struts
are you running?  I'm still on 1.0 right now.

Something else I was considering was to use a naming convention like
"context.name", and then have a utility method that would iterate
through the session and remove "mymodule.*".  Not quite as elegant as
your solution though. =)

-james

--
[]  James A. Hillyerd <ja...@hillyerd.com> - Java Software Engineer
[]  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Session management for cached resources

Posted by "James A. Hillyerd" <ja...@hillyerd.com>.
On Wed, 2002-10-02 at 19:14, Andrew Hill wrote:
> Im doing something rather like this, only I called it an "OperationContext"
> which comprises a hashtable of attributes and an id to store it under in the
> session (passed in the request). I simply overrode the RequestProcessor so
> it knew to look for an actionform in the OperationContext first if the form
> scope is session.
> Works quite nicely.

That sounds pretty close to what I want to do.  Which version of Struts
are you running?  I'm still on 1.0 right now.

Something else I was considering was to use a naming convention like
"context.name", and then have a utility method that would iterate
through the session and remove "mymodule.*".  Not quite as elegant as
your solution though. =)

-james

-- 
[]  James A. Hillyerd <ja...@hillyerd.com> - Java Software Engineer
[]  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Session management for cached resources

Posted by Andrew Hill <an...@gridnode.com>.
Im doing something rather like this, only I called it an "OperationContext"
which comprises a hashtable of attributes and an id to store it under in the
session (passed in the request). I simply overrode the RequestProcessor so
it knew to look for an actionform in the OperationContext first if the form
scope is session.
Works quite nicely.

-----Original Message-----
From: James A. Hillyerd [mailto:james@hillyerd.com]
Sent: Thursday, October 03, 2002 03:52
To: Struts Users Mailing List
Subject: Session management for cached resources


Hi all,

The Husted.com Struts Catalog mentions a technique for providing session
management for cached resources (a Resource Cache):

"Most Web applications require use of a workflow, and need to save
ActionForms and other attributes for future use. These items may also
need to be released in a block when the workflow completes. A convenient
way to handle this is to define a "Resource Cache". This can simply be a
hash map that uses a wrapper object to manage its items. The wrapper
object can include a named "scope", a property to indicate whether the
item is permanent or temporary, and a counter. To keep the cache
manageable, a threshold can be set, and the oldest temporary items
removed when the threshold is reached and a new item needs to be added."

( from http://husted.com/struts/catalog.html )

I can't find any information in the archives or online about
implementing something like this.  It seems like it would be difficult
to integrate with struts. How would struts handle having it's form beans
nested within this "Resource Cache" object?

Thanks.

-james

--
[]  James A. Hillyerd <ja...@hillyerd.com> - Java Software Engineer
[]  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>