$Session Open: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
No edit summary
Line 12: Line 12:
The third argument is the time to wait for an in-use session to be closed before giving up. A value of -1 indicates to use the value of the SRSDEFOW parameter. This argument defaults to -1, that is the value of the SRSDEFOW parameter.
The third argument is the time to wait for an in-use session to be closed before giving up. A value of -1 indicates to use the value of the SRSDEFOW parameter. This argument defaults to -1, that is the value of the SRSDEFOW parameter.
==Syntax==
==Syntax==
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Session_Open</span>(<span class="term">sesid</span>, <span class="term">owner</span>, <span class="term">timeout</span>)
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Session_Open</span>(<span class="term">sesid</span>, [<span class="term">owner</span>], [<span class="term">timeout</span>])
</p>
</p>
<p class="caption">$Session_Open function
 
</p>
===Return codes===
<p>%RC is set to 0 or to an error indicator.</p>
<p>
<p class="code">  
<var class="term">%rc</var> is set to 0 or to an error indicator.</p>
0 - No errors
<p class="code">0 - No errors
1 - Session not found
1 - Session not found
2 - Session in use
2 - Session in use
</p>
<p class="caption">$Session_Open return codes
</p>
</p>




==Usage notes==
Use of a non-zero timeout for <var>$Session_Open</var> can be useful for single-threading multiple threads through a request or for dealing with timing problems where it's possible for a request for a session to come in before the previous one is completely done. This is quite possible in <var class="product">[[Janus Web Server]]</var> applications where a request resulting from a redirect comes in before the redirecting thread has closed the session or where a user cancels a request and then resubmits it while the original request is still processing and so has the session open.
Use of a non-zero timeout for <var>$Session_Open</var> can be useful for single-threading multiple threads through a request or for dealing with timing problems where it's possible for a request for a session to come in before the previous one is completely done. This is quite possible in <var class="product">[[Janus Web Server]]</var> applications where a request resulting from a redirect comes in before the redirecting thread has closed the session or where a user cancels a request and then resubmits it while the original request is still processing and so has the session open.
==Example==
The following retrieves a session id from a cookie and opens it:
The following retrieves a session id from a cookie and opens it:
<p class="code"> %SESID = $WEB_GET_COOKIE('SESID')
<p class="code">%SESID = $WEB_GET_COOKIE('SESID')
%RC = $Session_Open(%SESID)
%RC = $Session_Open(%SESID)
</p>
</p>


Line 43: Line 44:
<li>[[Japanese functions]]</li>
<li>[[Japanese functions]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
<p>
</p>


[[Category:$Functions|$Session_Open]]
[[Category:$Functions|$Session_Open]]

Revision as of 22:09, 12 April 2013

Open a session

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Open function is to be entered.

$Session_Open opens a previously created session, accepts three arguments and returns a zero, indicating success, or a number indicating the cause of error, if there is one.

The first argument is the id of the session to be opened. This is a required argument.

The second argument is the userid that owns the session to be opened. An owner of "*" means that the session is public, that is available to all users. This optional argument defaults to the creating user's userid.

The third argument is the time to wait for an in-use session to be closed before giving up. A value of -1 indicates to use the value of the SRSDEFOW parameter. This argument defaults to -1, that is the value of the SRSDEFOW parameter.

Syntax

%rc = $Session_Open(sesid, [owner], [timeout])

Return codes

%rc is set to 0 or to an error indicator.

0 - No errors 1 - Session not found 2 - Session in use


Usage notes

Use of a non-zero timeout for $Session_Open can be useful for single-threading multiple threads through a request or for dealing with timing problems where it's possible for a request for a session to come in before the previous one is completely done. This is quite possible in Janus Web Server applications where a request resulting from a redirect comes in before the redirecting thread has closed the session or where a user cancels a request and then resubmits it while the original request is still processing and so has the session open.

Example

The following retrieves a session id from a cookie and opens it:

%SESID = $WEB_GET_COOKIE('SESID') %RC = $Session_Open(%SESID)


Products authorizing $Session_Open