![]() |
|||||||||||||||||
| |
|
|
|||||||||||||||
|
Session Control Points 1. Session Startup When the top page URL is requested a new session is started for the new user This is your 1st opportunity to customise interactions with this particular user public Session() {super(); /* ** Put your per-session initialization code here ** */ System.out.println("Second step: Session starts");} 2. Session Runs 3. Session shutdown Automatically terminate after a timeout period of no interaction - default is 1 hour Releases resources which improves scalability and enhances security The default timeout for all sessions is set in the application class public Application() {super(); /* ** Put your application initialization code here ** */ System.out.println("First step: Server starting up"); //change the default session time out in seconds setSessionTimeOut (new Integer (60 * 10));} You can also set the time out for a particular session in the session constructor You can end the session when you want to, e.g. when the customer has finished placing an order Session().terminate;You can override terminate to cleanup the session public void terminate() { /* ** Put your session shutdown code here ** */ System.out.println("Second last step: Session shutdown"); super.terminate();} Lecture 3 Demo 1 (Download)
Page updated August 25, 2004 |
||||||||||||||||
|
|
|||||||||||||||||