Maintaining State: %CSP.Request, %CSP.Session, %CSP.Response
HTTP is a stateless protocol. It provides no resources for storing information across page requests. CSP, however, provides three different types of objects for passing information between page requests:
%CSP.RequestOpens in a new tab — This class encapsulates information about an incoming request for a CSP page. When the CSP server receives a request, it instantiates the class with information about the request. The server makes this object available to the CSP page processing the request through the %request variable. Among the data included in %request are any values included in the page request URL's query string. After the CSP server generates the page to service the request, it destroys the %request object. For more information about %request and %CSP.RequestOpens in a new tab, please read HTTP Requests in CSP in Using Caché Server Pages (CSP).
%CSP.SessionOpens in a new tab — This class encapsulates information about an individual session within a CSP application. A session begins when a user first requests a page of the application and continues while the user navigates the different pages of the application. The session ends either after a timeout or when the user leaves the application. In some cases a short grace period may be added to the end of a session. When a session begins, the CSP Server creates an instance of %CSP.SessionOpens in a new tab and stores it on the CSP Server. The object is named %session. It is available to each page serving a request within the session. The application can store information, for example user identification, needed across the different page requests of the session within %session. For more information on CSP sessions, please read CSP Session Management in Using Caché Server Pages (CSP).
%CSP.ResponseOpens in a new tab — This class encapsulates information about the content of the HTTP headers for a page being generated. The CSP server instantiates the object, named %response, and makes it available to the CSP page responding to a request. Using %response, a CSP page can, for example, set the content type for a response and redirect a request to a different CSP page. For more information about %response and %CSP.ResponseOpens in a new tab, please read HTTP Requests in CSP in Using Caché Server Pages (CSP)