Yes the refresh happens second time as well, after 50 minutes, but then 5 minutes later the session dies and on next refresh a new session is created, result: the user is logged out. What puzzles me is that the session dies after 55 minutes and only on the production server.
Regards, HC > -----Original Message----- > From: A mailing list for discussion about Sun Microsystem's Java Servlet API > Technology. [mailto:[EMAIL PROTECTED]] On Behalf Of > Bhushan_Bhangale > Sent: 18. juli 2002 12:48 > To: [EMAIL PROTECTED] > Subject: Re: HttpSessionBindingListener behaves differently in test and production > > Does the refresh happening second time as well? I suspect because first time it is > happening and may be second time not as 25 min + 30 min = 55 min, and after 55 > min the session is dying. > > -----Original Message----- > From: HC Hammerstoft, InterResearch A/S [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 18, 2002 4:12 PM > To: [EMAIL PROTECTED] > Subject: Re: HttpSessionBindingListener behaves differently in test and > production > > > When run local and on test server (local network) the session does not > die, before the user either logs out or timeout is reached. The counter > in the BoundObjectSerializable object increments fine. > > But when run on production server the session dies, and the valueUnbound > is called stating that the session has lasted approx 3300 seconds. > But I am interested in why the session dies, as this is what I am trying > to prevent with the refresh part. > > Regards, HC Hammerstoft > > > -----Original Message----- > > From: A mailing list for discussion about Sun Microsystem's Java > Servlet API > > Technology. [mailto:[EMAIL PROTECTED]] On Behalf Of > > Bhushan_Bhangale > > Sent: 18. juli 2002 12:29 > > To: [EMAIL PROTECTED] > > Subject: Re: HttpSessionBindingListener behaves differently in test > and production > > > > Are you sure that you are able to keep the session alive always? > > As if the session is dying then certainly the unbounding will take > place. > > > > -----Original Message----- > > From: HC Hammerstoft, InterResearch A/S [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, July 18, 2002 3:30 PM > > To: [EMAIL PROTECTED] > > Subject: HttpSessionBindingListener behaves differently in test and > > production > > > > > > Hi, > > > > I also have problems with HttpSessionBindingListener. > > We run a web application where the main window refreshes itself after > 25 > > minutes. The session timeout in web.xml is set to 30 minutes. The > > refresh is to keep the session tracking alive, so the user is not > logged > > out as long as the main window is open. > > In the session we have a single object (params) that implements > > HttpSessionBindingListener in order to initialize and cleanup the > > params. > > The problem is that when run locally (JBuilder6 and Tomcat 3.2.3) and > on > > internal test server (Tomcat 3.2.3 standalone) sessions are kept alive > > fine. But when deployed on our production server (Tomcat 3.2.3 > > standalone) the session is unbound after approx. 3300 seconds...?? > > I have made a simple test Servlet (see below), which behaves the same > > way. > > Any input will be much appreciated. > > > > package net.defgo.test; > > > > import javax.servlet.http.*; > > import java.io.PrintWriter; > > import java.util.Date; > > import java.text.SimpleDateFormat; > > > > public class TestServlet extends HttpServlet { > > private static final SimpleDateFormat timeFormatter = new > > SimpleDateFormat("HH:mm:ss"); > > > > //Service the request > > public void doGet(HttpServletRequest request, HttpServletResponse > > response) { > > try { > > response.setContentType("text/html"); > > PrintWriter out = response.getWriter(); > > > > HttpSession session = request.getSession(); > > BoundObjectSerializable boSession = (BoundObjectSerializable) > > session.getAttribute("boSessionDef"); > > > > if (boSession == null) { > > boSession = new BoundObjectSerializable("js version"); > > session.setAttribute("boSessionDef", boSession); > > System.out.println(timeFormatter.format(new Date()) + ", > > boSession = " + boSession + " created"); > > } > > > > System.out.println(timeFormatter.format(new Date()) + ", id=" + > > session.getId()); > > > > response.setDateHeader("Expires", 0); > > response.setHeader("Pragma", "no-cache"); > > if (request.getProtocol().equals("HTTP/1.1")) { > > response.setHeader("Cache-Control", "no-cache"); > > } > > > > out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 > > Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">"); > > out.println("<html>"); > > out.println("<head>"); > > out.println("<meta name=\"Language\" content=\"da,en-us\">"); > > out.println("<meta http-equiv=\"Content-Type\" > > content=\"text/html; charset=iso-8859-1\">"); > > out.println("<script language=\"JavaScript\"><!--"); > > out.println("var tID = '';\n"); > > out.println("function executeTimer() {"); > > out.println(" location.href = '" + > > response.encodeURL(request.getRequestURI()) + "';"); > > out.println("}"); > > out.println("//--></script>\n"); > > > > out.println("</head>"); > > out.println("<body onLoad=\"tID = > > setTimeout('executeTimer()',1500000)>"); // 1500 secs = 25 min > > out.println("<p>msg = " + boSession.getSomething() + "</p>"); > > out.println("</body>"); > > out.println("</html>"); > > out.close(); > > } catch (Exception e) { > > e.printStackTrace(System.out); > > } // catch > > > > } > > > > } > > > > > > package net.defgo.test; > > > > import javax.servlet.http.HttpSessionBindingListener; > > import javax.servlet.http.HttpSessionBindingEvent; > > import java.text.SimpleDateFormat; > > import java.util.Date; > > import java.io.Serializable; > > > > public class BoundObjectSerializable implements > > HttpSessionBindingListener, Serializable { > > private static final SimpleDateFormat timeFormatter = new > > SimpleDateFormat("HH:mm:ss"); > > private String something = null; > > private int counter; > > private long started; > > > > public BoundObjectSerializable(String something) { > > this.something = something; > > started = System.currentTimeMillis(); > > } > > > > public String getSomething() { > > return something + " counter=" + counter++ + " session duration = > " > > + (System.currentTimeMillis() - started)/1000 + " secs"; > > } > > > > public void valueBound (HttpSessionBindingEvent event) { > > System.out.println (timeFormatter.format(new Date()) + ", > > valueBound: I've been bound to \"" + event.getName () + "\" for > session > > id: " + (event.getSession()).getId ()); > > } > > > > public void valueUnbound (HttpSessionBindingEvent event) { > > System.out.println (timeFormatter.format(new Date()) + ", > > valueUnbound: I've been unbound from \"" + event.getName () + "\" for > > session id: " + (event.getSession ()).getId () + " session duration = > " > > + (System.currentTimeMillis() - started)/1000 + " secs" ); > > } > > > > } > > > > Best regards > > > > HC Hammerstoft > > > > > __________________________________________________________________ > > _________ > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > > of the message "signoff SERVLET-INTEREST". > > > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > > Resources: > http://java.sun.com/products/servlet/external-resources.html > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > > > > __________________________________________________________________ > > _________ > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body > > of the message "signoff SERVLET-INTEREST". > > > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > > Resources: > http://java.sun.com/products/servlet/external-resources.html > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > __________________________________________________________________ > _________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > > __________________________________________________________________ > _________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
