$Web Proc Send or $Web ProcSend: Difference between revisions
m (→Status codes) |
m (→Status codes) |
||
Line 82: | Line 82: | ||
This sample shows how customized lines of HTML can be interspersed with static bodies of HTML by alternate calls to <var>$Web_ProcSend</var> and <var>$Web_Put_Text</var>. First the procedure SALUTATION is sent to the client buffer from file PROMOS. The MORE flag allows us to continue sending. Next a customized greeting is placed in the buffer, then the body of the document is taken from procedure DUFF_BEER_PROMOTION, again with the MORE flag, then a custom sign-off line, then the end of the HTML document without the MORE flag. </p> | This sample shows how customized lines of HTML can be interspersed with static bodies of HTML by alternate calls to <var>$Web_ProcSend</var> and <var>$Web_Put_Text</var>. First the procedure SALUTATION is sent to the client buffer from file PROMOS. The MORE flag allows us to continue sending. Next a customized greeting is placed in the buffer, then the body of the document is taken from procedure DUFF_BEER_PROMOTION, again with the MORE flag, then a custom sign-off line, then the end of the HTML document without the MORE flag. </p> | ||
<p> | <p> | ||
The $WEB_PROC_SEND without the MORE sends all the content that has been accumulated to that point, followed by the indicated procedure. After everything has been sent, the connection with the client is terminated. Any functions that start with <tt>$Web</tt> that require a connection with the client would cause a user restart after this point, as would any other attempt to communicate with the client. Because of this, there's relatively little that can usually be done after a $WEB_PROC_SEND without MORE (or a $Web_Done); so it's not atypical, as in this example, for such a call to be followed almost immediately by a STOP statement.</p> | The <var>$WEB_PROC_SEND</var> without the MORE sends all the content that has been accumulated to that point, followed by the indicated procedure. After everything has been sent, the connection with the client is terminated. Any functions that start with <tt>$Web</tt> that require a connection with the client would cause a user restart after this point, as would any other attempt to communicate with the client. Because of this, there's relatively little that can usually be done after a <var>$WEB_PROC_SEND</var> without MORE (or a $Web_Done); so it's not atypical, as in this example, for such a call to be followed almost immediately by a STOP statement.</p> | ||
[[Category:Janus Web Server $functions|$Web_ProcSend]] | [[Category:Janus Web Server $functions|$Web_ProcSend]] |
Revision as of 20:26, 26 October 2012
<section begin="desc" />Add contents of procedure to response<section end="desc" />
$Web_Proc_Send adds the contents of a procedure to the client buffer.
Note: $Web_ProcSend is a synonym for $Web_Proc_Send.
$Web_Proc_Send is a callable $function.
Syntax
<section begin="syntax" />%rc = $Web_Proc[_]Send( filename, procname, p_flag ) <section end="syntax" />
SYntax terms
filename | The name of the Model 204 file or group containing the procedure to be sent. This parameter is optional. If it is not specified, the default file or group is used.
The parameter may be specified in either of these ways:
The file privileges for this procedure file must be at least X'02' (copy or display internal procedures). | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
procname | The name of the Model 204 procedure to be sent to the client. This parameter is required. | ||||||||||||||
p_flag | Processing indicators for how the client should handle the procedure. This parameter is optional. It consists of a combination of blank-separated options. Valid options are:
|
Status codes
Code | Meaning |
---|---|
0 | Procedure successfully sent. |
-1 | Not a web thread |
Examples
Sample code follows:
%X = $Web_Type('text/HTML') %X = $Web_On ... %X = $Web_ProcSend( 'PROMOS', 'SALUTATION', 'MORE' ) %X = $Web_Put_Text( '
Dear ' WITH %FULLNAME) %X = $Web_ProcSend( 'PROMOS', 'DUFF_BEER_PROMO', 'MORE' ) %X = $Web_Put_Text( '
Act now ' WITH %FIRSTNAME WITH ', while supplies last' ) %X = $Web_ProcSend( 'PROMOS' ) STOP
This sample shows how customized lines of HTML can be interspersed with static bodies of HTML by alternate calls to $Web_ProcSend and $Web_Put_Text. First the procedure SALUTATION is sent to the client buffer from file PROMOS. The MORE flag allows us to continue sending. Next a customized greeting is placed in the buffer, then the body of the document is taken from procedure DUFF_BEER_PROMOTION, again with the MORE flag, then a custom sign-off line, then the end of the HTML document without the MORE flag.
The $WEB_PROC_SEND without the MORE sends all the content that has been accumulated to that point, followed by the indicated procedure. After everything has been sent, the connection with the client is terminated. Any functions that start with $Web that require a connection with the client would cause a user restart after this point, as would any other attempt to communicate with the client. Because of this, there's relatively little that can usually be done after a $WEB_PROC_SEND without MORE (or a $Web_Done); so it's not atypical, as in this example, for such a call to be followed almost immediately by a STOP statement.