Table of Contents Previous Section
Session Initialization
A session object is created each time the application receives a component action request from a new user. An application may have multiple sessions running concurrently. The session ends when a session time-out value is reached.Note: By default, applications create session objects during the first cycle of the request-response loop. This is because by default, the first request is handled by the component action request handler, which creates a session. If you change the default request handler to the direct action request handler, you do not have a session object. See "WebObjects Viewed Through Its Classes" for clarification.
//WebScript Session.wos
- init {
id woApp = [WOApplication application];
self = [super init];
[self setTimeOut:120]; // session idle time is 2 minutes.
[woApp setSessionCount:[woApp sessionCount + 1];
sessionNumber = [woApp sessionCount];
return self;
} //Java Session.java
public Session() {
super();
Application woApp = (Application)WOApplication.application();
this.setTimeOut(120);
woApp.setSessionCount(woApp.sessionCount() + 1);
sessionNumber = woApp.sessionCount();
}
Table of Contents Next Section