O'Reilly logo

IBM WebSphere: Deployment and Advanced Configuration by Roland Barcia, Keys Botzum, Tom Alcott, Bill Hines

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Session API

The interface declaration of HttpSession contains over a dozen methods in all. Minimally, an application will likely call three of these methods. The first of these is the getSession() method, which is used to either create a session object if one does not already exist or to associate a request with an existing session. In order to store information in the session object, the setAttribute() method is called, and the application retrieves information that is stored via a call to the getAttribute() method. Often overlooked in an application is the invalidate() method call. There should also be some provision in the application to invalidate the session object once the application no longer requires the session:

 session.invalidate() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required