This topic describes the process that occurs when a client requests
that a Java channel application session be established on the server.
This process must be performed if the application is required to run
in a session with an application session.
The session must be established between the client and the server before
any operation being performed by the application. This process generates
a unique session ID that is used to maintain the session. The Rich
Client Channel supports the use of the servlet engine's implementation of session management using either cookies
or a predefined sessionId parameter in the protocol.
The following procedure establishes a session:
CSClient requests establishment of a session.
The CSClient
on the client side is responsible for creating the session establishment
request.
The application must invoke one of the following methods:
- establishSession()
- establishSession(boolean newSession)
The CSClient uses the
CSConnectionCookies to
store any cookies used in creating a connection. This enables the CSClient to pass information in the cookies such
as the user ID and password when the toolkit is attempting to access
a proxy security application. When the CSClient receives a response, it updates the
CSConnectionCookies with
any new cookies received from the server. The storage policy that
CSConnectionCookies uses
is incremental so that it stores all cookies received from or sent
to servers. This policy means that it cannot lose any cookies. Currently,
the CSClient sends all cookies with any client request.
Note: CSConnectionCookies does
not have a timeout policy implemented to remove old cookies.
If
the application invokes establishSession with no parameters, or
with a boolean value of true, a new session is created. If the method is invoked with a boolean value of false, an existing session is used.
CSServer handles the session establishment request.
CSServer
on the server side is responsible for receiving the data sent from
the client. It does the following:
- Determines if a new session should be created from the sessionId and serverId.
- Uses the createSession parameter to determine
if the request should create a new session or use an existing session
- If the request is for an existing session, uses the TID to determine
the existing session from the application session table
- CSServer sends the session establishment data to the client. Once the request to establish the session is complete, the CSServer prepares the data to be sent to the client.
- CSClient receives the session establishment data. On the client
side, the data is received and CSClient performs the following steps:
- Determines if the session has been successfully established.
- Updates the CSClient with the values obtained in the response.