Tamas Szabo wrote the following on 7/28/2005 12:51 PM:

Could you clear this situation for me:

User A is using the app, then his session expires.
User B starts to use the app.

User A comes back and want to access a page in the app. Remember that his session is expired and User B is already using the app.
You redirect him to index.jsp? Or to appInUse.jsp?

He should go to "appInUse.jsp" BUT

if A's session has expired and no one else is using the app (B didn't log in), user "A" should go to index.jsp - this is a bit confusing since in order to determine if he can go to index.jsp we need to make him have a session - which is why path checking needs to take place to dictate what should/shouldn't be done.

At first I would say that you could use a second filter which checks for expired session.
This way the situation will be clear.
One filter limits the sessions the other filter checks for timeouted sessions.

That would probably be a good idea to use two filters vs doing it all in one. Although it could also be nice to see all that happens for each request by looking in just one filter vs two.

2) I noticed a lot of odd behavior when the server was shut down and the pages were still up. For example, if the user was left on a page that displayed a "log off" link and the server was restarted, when they then clicked on log off (which calls session invalidate) it would decrement the sessionCounter to -1. I'm not sure how sessionDestroyed could get called before sessionCreated, but I guess it can? My hack here was to do a check for sessionCount being less than 0 and if so reset it to 0.

This is strange. What kind of webcontainer do you use?
At first glance it seems like your web container has a 'feature' to serialize sessions on stop and to recreate them when you start the server again. In this case the sessionCounter would be set to 0 on restart but the session would be recreated => no sessionCreated() executed, just
sessionDestroyed() on logout...

Possibly that is what is happening. The scenario where I noticed this was using JBoss (Tomcat as the app server in JBoss).

OK here is the filter that I'd love some clean up on. There must be a way to make this less ugly...you can try this link to see the full version:

I will check it tomorrow...sorry

No problem. I appreciate all your help so far.


--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to