• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session.invalidate()

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

//User clicks SWITCH IDENTITY, we are require to abandon
// existing session & switch to new login user
// Code snipplets below
HttpSession session = request.getSession();
if (session != null)
session.invalidate(); // destroy everything on session
// We then require a Total new session
session = request.getSession(true);
In Jrun3, The session above returns the old session which
will throw exception if we call
session.putValue ("Name", "XX");
Anyone can suggest how I can access a new session
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have tested the following code in servletrunner and it is working properly.Destroys the session and creates a new session.
//code
HttpSession session = req.getSession(true);
session.invalidate();
session = req.getSession(true);
session.putValue("Hello","Test");
regards,
Thilak.V

Originally posted by kuaikuai:

//User clicks SWITCH IDENTITY, we are require to abandon
// existing session & switch to new login user
// Code snipplets below
HttpSession session = request.getSession();
if (session != null)
session.invalidate(); // destroy everything on session
// We then require a Total new session
session = request.getSession(true);
In Jrun3, The session above returns the old session which
will throw exception if we call
session.putValue ("Name", "XX");
Anyone can suggest how I can access a new session


 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Session can be loosely defined as a connection (connection-less connection as HTTPServlets are HTTP centric) thus renewal or establishing a new session should invlove server and client ports to recommunicate and restablish a connection-less connection (TCP based). Now when the old session is invalidated and a new one is REQUESTED, there could not be an immediate response where that is also dependent upon network status, etc.... So could it be that you need to check if the new session has established before you can do something with it, like naming it. etc..
Any Comments........
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai Adams,
can you explain me what is connection-less-connection and HTTP centric connection?is there any other types of connections possible?
yours
balraj
 
reply
    Bookmark Topic Watch Topic
  • New Topic