A module for dealing with the HTTP session.
session:clear() as empty-sequence()
Removes all attributes from the current HTTP session. Does NOT invalidate the session.
session:create() as empty-sequence()
Initialize an HTTP session if not already present (and valid)
session:encode-url($url as xs:anyURI) as xs:anyURI
Encodes the specified URL with the current HTTP session-id.
$url | The URL to encode |
session:exists() as xs:boolean
Returns whether a session object exists.
session:get-attribute($name as xs:string) as item()*
Returns an attribute stored in the current session object or an empty sequence if the attribute cannot be found.
$name | The session attribute name |
session:get-attribute-names() as xs:string*
Returns a sequence containing the names of all session attributes defined within the current HTTP session.
session:get-creation-time() as xs:dateTime
Returns the time when this session was created. If a session does not exist, a new one is created. If the session is already invalidated, it returns January 1, 1970 GMT
session:get-id() as xs:string?
Returns the ID of the current session or an empty sequence if there is no session.
session:get-last-accessed-time() as xs:dateTime
Returns the last time the client sent a request associated with this session. If a session does not exist, a new one is created. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time. If the session is already invalidated, it returns January 1, 1970 GMT
session:get-max-inactive-interval() as xs:int
Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the session:set-max-inactive-interval function. A negative time indicates the session should never timeout.
session:invalidate() as empty-sequence()
Invalidate (remove) the current HTTP session if present
session:remove-attribute($name as xs:string) as empty-sequence()
Removes the attribute with the supplied name from the current session
$name | The attribute name |
session:set-attribute($name as xs:string, $value as item()*) as empty-sequence()
Stores a value in the current session using the supplied attribute name. If no session exists, then one will be created.
$name | The attribute name |
$value* | The value to be stored in the session by the attribute name |
session:set-current-user($user-name as xs:string, $password as xs:string) as xs:boolean
Change the user identity for the current HTTP session. Subsequent XQueries in the session will run with the new user identity.
$user-name | The user name |
$password | The password |
session:set-max-inactive-interval($interval as xs:int) as empty-sequence()
Sets the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. A negative time indicates the session should never timeout.
$interval | The maximum inactive interval (in seconds) before closing the session |