Re: [picocontainer-dev] Storing Cached items in HttpSession?
Paul Hammant <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
>
>> For a session container (web app), can we store the Cached items in
>> the HttpSession? I mean as an alternative to storing the whole
>> container in the session ?
>
> Isn't it what we do with the SessionReference impl?
Indeed it is. I was thinking of something like..
DefaultPicoContainer appScope = new DefaultPicoContainer(new
Caching());
DefaultPicoContainer sessionScope = new DefaultPicoContainer
(new HttpSessionCaching(httpReq.getSession()), appScope);
DefaultPicoContainer requestScope = new DefaultPicoContainer
(sessionScope); // no cache at all for actions (etc).
The difference is in the detail. In the current design, individual
entries are stored in the session's attributes.....
public void set(Object item) {
session.setAttribute(key, item);
}
public Object get() {
return session.getAttribute(key);
}
Perhaps if this happens at the BehaviorFactory level, a single
essentially private object could be stored in the session attributes
that is a hidden map. Nothing else could retrieve data from it,
meaning we're doing a bit more of the inversion of IoC.
Thoughts?
- Paul