$Session Open: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
m (misc cleanup)
 
(3 intermediate revisions by one other user not shown)
Line 2: Line 2:
<span class="pageSubtitle">Open a session</span>
<span class="pageSubtitle">Open a session</span>


<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Open function is <var>[[GetSession (Object subroutine)|GetSession]]</var>.</p>
<p class="warn"><b>Note:</b> Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Open function is <var>[[GetSession (Object subroutine)|GetSession]]</var>.</p>


<var>$Session_Open</var> opens a previously created [[Sessions|session]].  
<var>$Session_Open</var> opens a previously created [[Sessions|session]].  


==Syntax==
==Syntax==
Line 11: Line 10:
</p>
</p>


<var>$Session_Open</var> accepts three arguments and returns a zero, indicating success, or a number indicating the cause of error, if there is one.
<table>
<tr><th>%rc</th>
<td>A returned zero, indicating success, or a number indicating the cause of error, if there is one.</td></tr>


The first argument is the id of the session to be opened. This is a required argument.  
<tr><th>sesid</th>
<td>The ID of the session to be opened. This is a required argument.</td></tr>


The second argument is the userid that owns the session to be opened. An <var class="term">owner</var> value of asterisk (<tt>*</tt>) means that the session is public, that is available to all users. This optional argument defaults to the creating user's userid.  
<tr><th>owner</th>
<td>The userid that owns the session to be opened. An <var class="term">owner</var> value of asterisk (<tt>*</tt>) means that the session is public, that is available to all users.  
<p>
This optional argument defaults to the creating user's userid. </p></td></tr>


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.
<tr><th>timeout</th>
<td>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 <var>[[SRSDEFTO parameter|SRSDEFTO]]</var> parameter. This argument defaults to -1, that is, the value of the <var>SRSDEFTO</var> parameter.</td></tr>
</table>


===Return codes===
===Return codes===
Line 28: Line 35:


==Usage notes==
==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 one of these occurs:
<ul>
<li>A request resulting from a redirect comes in before the redirecting thread has closed the session</li>
 
<li>A user cancels a request and then resubmits it while the original request is still processing and so has the session open.</li>
</ul>


==Example==
==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 41: Line 53:
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>Japanese functions</li>
<li>Japanese functions</li>
<li>[http://m204wiki.rocketsoftware.com/images/4/4b/SirfieldNew.pdf Sir2000 Field Migration Facility]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>
</ul>


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

Latest revision as of 22:48, 6 October 2015

Open a session

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Open function is GetSession.

$Session_Open opens a previously created session.

Syntax

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

%rc A returned zero, indicating success, or a number indicating the cause of error, if there is one.
sesid The ID of the session to be opened. This is a required argument.
owner The userid that owns the session to be opened. An owner value of asterisk (*) means that the session is public, that is available to all users.

This optional argument defaults to the creating user's userid.

timeout 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 SRSDEFTO parameter. This argument defaults to -1, that is, the value of the SRSDEFTO parameter.

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 one of these occurs:

  • A request resulting from a redirect comes in before the redirecting thread has closed the session
  • 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