Session2 class (deprecated)
The Session2 class is deprecated and is provided for backward compatibility only. New applications should use the methods provided by the standard javax.servlet.http.HttpSession interface. In addition, NAS provides the HttpSession2 interface, an extension to HttpSession that supports applications that must call AppLogics.
For more information, see Chapter 11, "Creating and Managing User Sessions," in the Programmer's Guide (Java), or see the Migration Guide.
The Session2 class is designed to help you implement a custom session class if your application requires additional session functionality. To create a custom session class, subclass the Session2 class, then define new methods. Your subclass can, for example, define accessor methods to read and write information specific to your session. An online shopping application, for example, might require specialized methods, such as AddItemToCart( ), to track shopping items per user session.
When you subclass the Session2 class, you must do the following:
ISession2 s = super.createSession(flags, timeout, appname,
sessionid, idgen);
if (s!= null)
sess = new MySession(s);
return s;
Pass in the ISession2 interface in the subclass constructor, as shown in the following example: public class MySession extends Session2
{
public MySession(ISession2 sess)
Because the Session2 class delegates the implementation of methods in the ISession2 interface to the object passed to its constructor, you don't have to implement every method of that interface in your subclass. You need only define the methods you want to add.
Package
com.kivasoft.session
Related Topics
ISession2 interface (deprecated)
|