XQuery Function Documentation
http://exist-db.org/xquery/session
java:org.exist.xquery.functions.session.SessionModule
A module for dealing with the HTTP session.
session:clear #0
session:clear () as empty-sequence()
Removes all attributes from the current HTTP session. Does NOT invalidate the session.
- Returns:
- empty-sequence()
session:create #0
session:create () as empty-sequence()
Initialize an HTTP session if not already present (and valid)
- Returns:
- empty-sequence()
session:encode-url #1
session:encode-url ($url as xs:anyURI) as xs:anyURI
Encodes the specified URL with the current HTTP session-id.
- Parameters:
$url The URL to encode - Returns:
- xs:anyURI : the encoded URL
session:exists #0
session:exists () as xs:boolean
Returns whether a session object exists.
- Returns:
- xs:boolean : true if the session object exists
session:get-attribute #1
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.
- Parameters:
$name The session attribute name - Returns:
- item()* : the attribute value
session:get-attribute-names #0
session:get-attribute-names () as xs:string
Returns a sequence containing the names of all session attributes defined within the current HTTP session.
- Returns:
- xs:string* : the list of attribute names
session:get-creation-time #0
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
- Returns:
- xs:dateTime : the date-time when the session was created
session:get-id #0
session:get-id () as xs:string
Returns the ID of the current session or an empty sequence if there is no session.
- Returns:
- xs:string? : the session ID
session:get-last-accessed-time #0
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
- Returns:
- xs:dateTime : the date-time when the session was last accessed
session:get-max-inactive-interval #0
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.
- Returns:
- xs:int : the maximum time interval, in seconds
session:invalidate #0
session:invalidate () as empty-sequence()
Invalidate (remove) the current HTTP session if present
- Returns:
- empty-sequence()
session:remove-attribute #1
session:remove-attribute ($name as xs:string) as empty-sequence()
Removes the attribute with the supplied name from the current session
- Parameters:
$name The attribute name - Returns:
- empty-sequence()
session:set-attribute #2
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.
- Parameters:
$name The attribute name $value The value to be stored in the session by the attribute name - Returns:
- empty-sequence()
session:set-current-user #2
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.
- Parameters:
$user-name The user name $password The password - Returns:
- xs:boolean : true if the user name and password represent a valid user
session:set-max-inactive-interval #1
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.
- Parameters:
$interval The maximum inactive interval (in seconds) before closing the session - Returns:
- empty-sequence()