GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes create a new session when valid session is already existing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "create a new session when valid session is already existing?" Watch "create a new session when valid session is already existing?" New topic
Author

create a new session when valid session is already existing?

Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

Can we create a new session when one valid session is already existing for a specific user? If yes, then how ?


Regards
Salil Verma
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Verma
Yes , you can.
invalidate the session that's existing.
Create a new session using request.getSession(true) . session.isNew() should return true.
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
hi, not to hijack the thread, just a follow up question. Does creating a new session while another session is alive automatically invalidates the old/previous session? Is it possible to have two live sessions in a webapp? Im planning to try this later but until then maybe you can give some insights. Thanks.


I just cant look, its killing me.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

@lhorenz
Firstly , you cannot create a new session , when a session exists.

request.getSession() , would return existing session if exists , so its not possible . may be you can try to hack others session as you did with thread
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
Thanks Balu, good point for both session and thread-jacking
 
GeeCON Prague 2014
 
subject: create a new session when valid session is already existing?