Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ns_adp_abort(3aolserv) [debian man page]

ns_adp_exception(3aolserver)				    AOLserver Built-In Commands 			      ns_adp_exception(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
ns_adp_abort, ns_adp_break, ns_adp_exception, ns_adp_return - ADP exception handling SYNOPSIS
ns_adp_abort ?result? ns_adp_break ?result? ns_adp_exception ?varName? ns_adp_return ?result? _________________________________________________________________ DESCRIPTION
These commands enable early return and interrupt of an ADP execution. Internally, the exception routines sets a flag and return TCL_ERROR to begin unwinding the current Tcl call stack and return control to the ADP evaluation engine. It is possible for an enclosing catch com- mand to catch the exception and stop Tcl from returning control to ADP. The ns_adp_exception command can be used to test for this condi- tion. ns_adp_abort ?result? This command stops ADP processing, raising an execution and unwinding the stack to the top level as an error condition. The request handling code which invokes the first ADP file will normallly generate an error message in this case, ignoring the contents of the output buffer, if any. Note that the exeception can be caught by a catch command in script block which executes ns_adp_abort. How- ever, when that block returns control to the ADP execution engine, the stack will be continue to be unwound. The optional result argument, if present, will be used to set the Tcl interpreter result string. ns_adp_break ?result? This command stops execution of ADP and unwinds the ADP call stack. Unlike ns_adp_abort, the request handling code will generate a normal HTTP response with any contents of the output buffer. The optional result argument, if present, will be used to set the Tcl interpreter result string. ns_adp_exception ?varName? This command returns a boolean value if an exception has been raised. The optional varName provides the name of a variable to store one of ok, break, abort, or return to indicate the type of exception raised. ns_adp_return ?result? This function halts processing of the current ADP and sends any pending output (from ns_adp_puts or static HTML) up to the point where it was called to the browser. Nothing in the current ADP is output or executed after it is called. The return_value, if spec- ified, becomes the return value of the ADP. Note that this function returns only one level up the call stack. By contrast, ns_adp_abort and ns_adp_break will return all the way up the call stack. ns_adp_return is typically used from an ADP included by another ADP, to stop processing of the inner ADP while allowing the calling ADP to continue. The optional result argument, if present, will be used to set the Tcl interpreter result string. EXAMPLE
The following example demonstrates halting execution of the ADP after returning a complete response with one of the ns_return style com- mands: <% if !$authorized { ns_returnunauthorized; # Send complete response. ns_adp_abort; # Execution stops here. } %>. SEE ALSO
ns_adp(n) KEYWORDS
ADP, dynamic pages, exception AOLserver 4.5 ns_adp_exception(3aolserver)

Check Out this Related Man Page

ns_adp_puts(3aolserver) 				    AOLserver Built-In Commands 				   ns_adp_puts(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
ns_adp_append, ns_adp_close, ns_adp_dump, ns_adp_flush, ns_adp_puts, ns_adp_stream, ns_adp_tell, ns_adp_trunc, ns_puts - ADP output com- mands SYNOPSIS
ns_adp_append string ?string ...? ns_adp_close ns_adp_dump ns_adp_flush ns_adp_puts ?-nonewline? string ns_adp_stream ns_adp_tell ns_adp_trunc ?length? ns_puts ?-nonewline? string _________________________________________________________________ DESCRIPTION
These commands enable adding to and manipulation of the ADP output buffer. See ns_adp for an overview on ADP pages. ns_adp_append string ?string ...? This command appends one or more strings to the ADP output buffer. For the case of a single argument, it is equivalent to ns_adp_puts -nonewline string. ns_adp_close This command can be used to flush and close the underlying HTTP connection. ADP execution continues after the connection is closed; any text appended to the output buffer after the close is simply discarded when processing is complete. ns_adp_dump This command returns the text of the ADP buffer. ns_adp_flush This command flushes the contents of the ADP buffer to the current connection or file channel. It will raise a Tcl exception if the underlying flush failed, for example, if the HTTP connection is closed or the channel write failed. Flushed content is returned in "chunked-encoding" format if the HTTP protocol version is at least 1.1 (normally the case for all modern browsers). A call to ns_adp_flush is not normally needed except for specialized applications as all content is automatically flushed at the end of a con- nection or on buffer overflow. (see ns_adp_ctl bufsize for details on buffer mangement). ns_adp_puts ?-nonewline? string This function appends the specified string to the ADP buffer. Unless the optional -nonewline argument is used, a newline will be appended to the page after the string. Note that the argument to ns_adp_puts is a single string unlike ns_adp_append which takes a variable number of strings to append. ns_adp_stream This function begins streaming mode for the ADP. All data currently in the ADP output buffer is flushed and any subsequent data will be output directly to the connection. It is equivalent to an ns_adp_flush followed by an ns_adp_ctl bufsize 0. ns_adp_tell This function returns the total number of bytes current in the ADP buffer. A buffer overflow or direct call to ns_adp_flush will reset this counter to zero so the result of ns_adp_tell may not return the total number of bytes eventually sent. ns_adp_trunc ?length? This function can be used to truncate output buffer to the requested size. This can be useful to trim unintended white space or to clear a result and generate an error message. Note that content already streamed to the client, if any, cannot be truncated. ns_puts ?-nonewline? string This command is a deprecated name for ns_adp_puts. SEE ALSO
ns_adp(n), ns_adp_include(n) KEYWORDS
ADP, dynamic pages AOLserver 4.5 ns_adp_puts(3aolserver)
Man Page