struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Mulligan <david.mulli...@LECAN.ie>
Subject problem with HttpSession in Resin-2.1.2
Date Tue, 23 Jul 2002 17:06:08 GMT
Hey All,


Sorry, this isn't really a struts problem (but I'm using struts in my
application :-)


The problem is with HttpSession and resin-2.1.2

Everthing works just fine on Tomcat 4.0.3 and Websphere. 
But for some strange reason the HttpSession I create in my LogonAction loses
an attribute (The UserBean) in the next request (only with Resin)!

In the LogonAction is got something like this

HttpSession session = request.getSession(true);
session.setAttribute("theCurrentUser", user);
Enumeration enum = session.getAttributeNames();
while(enum.hasMoreElements() )       {
  String key = enum.nextElement().toString();
  System.out.println("key:"+key+", "+session.getAttribute(key).toString());
}


and in the Action I forward to I got


HttpSession session = request.getSession(false);
if(session != null) {
  Enumeration enum = session.getAttributeNames();
  while(enum.hasMoreElements() )       {
    String key = enum.nextElement().toString();
    System.out.println("key:"+key+",
"+session.getAttribute(key).toString());
  }
  this.user = (UserBean)session.getAttribute(Constants.USER_KEY);
} 
if(this.user == null)
  System.out.println("User is not logged in");


As expected, I get the below in the output after loging on.

key:org.apache.struts.action.LOCALE, en_US
key:theCurrentUser, mainsite.authentication.beans.UserBean@6df389
key:org.apache.struts.action.LOCALE, en_US
key:theCurrentUser, mainsite.authentication.beans.UserBean@6df389

As you can see the information gets printed out twice. 
Once for the LogonAction and once for the Action I forward to upon
successfull logins.


However if I now call the second Action directly I get 

key:org.apache.struts.action.LOCALE, en_US
User is not logged in



The UserBean has disappered!!!
Anyone got any ideas? 
Do I need to put something into the web.xml about session timeout for Resin?

Thanks in advance
dave



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message