views:

204

answers:

1

Hi,

I am using tomcat's authentication. When I leave the login page open for about half an hour so and then try to login, I get the following error:

URL: http://localhost/pc/j_security_check

Page Content:

Connection Interrupted

The connection to the server was reset while the page was loading.

The network link was interrupted while negotiating a connection. Please try again.

  • My guess is that since tomcat uses jsession cookie to maintain session and it times out, I get this error. What would be a good solution to this problem ? I am using Tomcat 6.0.20
+1  A: 

Just let the login page refresh itself whenever the session times out. You can make use of the meta refresh header and HttpSession#getMaxInactiveInterval() here. The last returns the amount of seconds the HttpSession has yet to live and that's exactly what you need in a meta refresh header.

<meta http-equiv="refresh" content="${pageContext.session.maxInactiveInterval}">

Include it in the HTML <head> of your login page.

BalusC