• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session methods invalidate(), isNew()

 
stefania ferrarelli
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have some doubts about session.isNew() and session.invalidate().I get parameters from the request, invalidate the session, make a new one, set attributes, link to the next servlet, then get false on session.isNew(), is it because I already made a request with this sessionID?

Can I invalidate a session and make a new one with no other consequences?

Thanks
Stefania
 
Ankit Garg
Sheriff
Posts: 9577
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the first code you'll get false on the next servlet as the session was created in a different request then the request in which you call isNew method.

As for your second code, you can invalidate and create a session. The consequences will be that all session attributes will be lost and a new cookie will be sent to the browser for the session...
 
stefania ferrarelli
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Ankit,
I needed a confirmation not to have misunderstood something!
Stefania
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic