[Webwork-user] Session interaction
Brought to you by:
baldree,
rickardoberg
From: Rickard O. <ri...@te...> - 2000-11-29 20:56:19
|
Hey Re: servlet agnostic session interaction. I think I have an interesting solution to this. Let's introduce an interface SessionAware, which contains the method public void setSession(java.util.Map session); When the action is created it is tested for SessionAware, and if the action implements it, it is called. However, since we want to keep the action servlet agnostic, it will get a Map and not the real Session. This Map will be a proxy object that simply converts the Map calls to Session calls. This way it should still be possible to run all actions without a servlet environment, for example in automatic testing (e.g. regression tests), and it should also be possible to reuse them in a Swing GUI, in which case the session is simply a HashMap or similar. What do you think? Some of the methods in Session are not available in Map, but I figured it is "good enough" and one can always get to those extra methods by using ServletAware. Is this nirvana yet? regards, Rickard |