Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating new session after invalidation in same request

 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I know that if a session gets invalidated, the next request creates a new one. But is it possible to create a new session in the same request as the invalidation? request.getSession() seems to return the invalidated session.

I guess a response.redirect() will automatically create a new request, but that would lose all the request parameters and I heard redirection can sometimes be disabled by clients and/or firewalls.

Thanks in advance,
Yuriy
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>I know that if a session gets invalidated, the next request creates a new one.
well, yes, if its a jsp.

>But is it possible to create a new session in the same request as the invalidation?

yes, see below.

>request.getSession() seems to return the invalidated session.


no it doesnt, it always returns a valid session.

try the folln jsp


 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right, I see what my problem was. After the invalidation, I was using EL to check session attributes instead of scriptlets/expressions. Checking ${pageContext.session.id} after invalidation shows that EL still uses the invalidated session.

Thanks!
Yuriy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic