Indy 9
TIdHTTPSession
Hierarchy, Properties, Methods, See Also, Unit: IdCustomHTTPServer
Implements a persistent HTTP Session.
TIdHTTPSession = class(TObject)
Unit
IdCustomHTTPServer
Description
TIdHTTPSession is a TObject descendant that implements a HTTP Session.

TIdHTTPSession also provides support for maintaining a persistent HTTP session and state for TIdHTTPServer. TIdHTTPSession is used with TIdHTTPSessionList to provide persistent HTTP session management using the SessionID property and the "IDSESSIONID" Cookie.

SessionID is the unique identifier for the HTTP session.

LastTimestamp is the date and time that the HTTP session was last modified.

RemoteHost is the address of the remote computer using the HTTP session.

Content is a storage area for string values that can be used to form HTTP request and/or response messages.


TIdHTTPSession.Content
TIdHTTPSession
Provides storage for HTTP message contents.
property Content: TStrings;
Description
Content is a TStrings property that stores string values that can be used to form the content for an HTTP request and/or response. Content can be used as a temporary storage area for values subsequently use in command or event handlers like TIdHTTP.OnCommandGet.

TIdHTTPSession.LastTimeStamp
TIdHTTPSession, See Also
Specifies the date and time a session was last modified.
property LastTimeStamp: TDateTime;
Description
LastTimeStamp is a read-only TDateTime property that identifies the date and time that a HTTP session was last modified. LastTimeStamp is used with the SessionTimeOut value from TIdHTTPDefaultSessionList to determine when a persistent HTTP session has expired.

LastTimeStamp is updated when a HTTP session is created or accessed for use with a HTTP request or response by TIdHTTPServer.


TIdHTTPSession.RemoteHost
TIdHTTPSession, See Also
Represents the remote computer address for the session.
property RemoteHost: string;
Description
RemoteHost is a read-only String property that represents the IP address for the remote computer system which is the endpoint for the HTTP session. RemoteHost is used when TIdHTTPDefaultSessionList.GetSession is used to locate a persistent session having the desired SessionID and RemoteHost for information provided in an HTTP session.

TIdHTTPSession.SessionID
TIdHTTPSession, See Also
Represents the unique session identifier.
property SessionID: String;
Description
SessionID is a String property that represents the unique identifier for the HTTP session. SessionID is the "IDSESSIONID" Cookie value used to implement HTTP session persistence. SessionID is used when TIdHTTPDefaultSessionList.GetSession is used to locate a persistent session having the desired SessionID and RemoteHost for information provided in an HTTP session. SessionID is updated when TIdCustomHTTPServer.CreateSession is ised to initalize a new session for requests to the server.

TIdHTTPSession.Create
TIdHTTPSession, See Also
Constructor for the object instance.
constructor Create(AOwner: TIdHTTPCustomSessionList); virtual;
Parameters
AOwner: TIdHTTPCustomSessionList
Owner of the object instance.
Description
Create is the constructor for the object instance, and is responsible for initializing properties specific to the TIdHTTPSession. Create does not call the inherited Create constructor.

AOwner is the owner of the object instance, and when assigned, should reflect the TIdHTTPCustomSessionList that owns the session object instance. AOwner is used to trigger the OnSessionStart event handler to perform session maintenance specific to the server implementation.


TIdHTTPSession.CreateInitialized
TIdHTTPSession
Constructor for the object instance.
constructor CreateInitialized(AOwner: TIdHTTPCustomSessionList; const SessionID: string; const RemoteIP: string); virtual;
Parameters
AOwner: TIdHTTPCustomSessionList
Session list that owns the object instance.
const SessionID: string
Session identifier for the object instance.
const RemoteIP: string
IP address for the remote host for the session.
Description
CreateInitialized is the constructor for the object instance, and initializes properties for the HTTP session including SessionID, RemoteHost, Content, Owner, OnSessionStart, and LastTimestamp to their default values.

The session identifier is set to the value specified in SessionID. RemoteHost is set to the value specified in RemoteIP. LastTimeStamp is set the current date and time on the HTTP server. Owner is set to the TIdHTTPCustomSessionList specified in AOwner that owns the object instance.

The Content property is created, and the OnSessionStart event handler is assigned the value from the session list that owns the object instance.

CreateInitialized is called from TIdHTTPFefaultSessionList.CreateSession, where a new session is created and added to the session list for the server.


TIdHTTPSession.Destroy
TIdHTTPSession
Frees the object instance.
destructor Destroy; override;
Description
Destroy is a procedure that acts as the destructor for the object instance, and is responsible for handling persistent session clean-up and freeing object properties for the session.

Destroy calls DoSessionEnd to trigger the OnSessionEnd event handler, and signals the Owner session list that the session should be removed.

Destroy clears the Content property, and frees the property instance.

Destroy frees the private and protected member variables used by the object instance.


TIdHTTPSession.Lock
TIdHTTPSession, See Also
Provides resource protection for Session properties and methods.
procedure Lock;
Description
Lock is a TCriticalSection property used to provide resource protection for the properties and methods of the HTTP session in a multi-threaded application. Lock is allocated in the Create method, and freed in Destroy.

TIdHTTPSession.Unlock
TIdHTTPSession
Enables access to the session from another thread.
procedure Unlock;
Description
Unlock is a procedure used to remove repsource protect for session properties and methods after a call to Lock. Unlock exits the TCriticalSection used to prevent multi-threaded access to the object instance properties and methods.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.