Apache Rivet

The Rivet Team

The Apache Software Foundation


            
        


Table of Contents

Introduction to Apache Rivet
Apache Rivet Installation
Apache Child Processes Lifecycle and Request Processing
Rivet Apache Directives
Rivet Tcl Commands and Variables
<?= ... ?> — Shorthand construct for single strings output
abort_code — Returns the code passed to abort_page earlier during the request processing
abort_page — Stops outputting data to web page, similar in purpose to PHP's die command.
apache_log_error — log messages to the Apache error log
apache_table — access and manipulate Apache tables in the request structure.
catch — wraps core command catch and handles in a special way fake error conditions resulting from calls to exit and abort_page
clock_to_rfc850_gmt — create a rfc850 time from [clock seconds].
cookie — get, set and delete cookies.
debug — A command to print strings, arrays and the values of variables as specified by the arguments.
env — Loads a single "environmental variable" into a Tcl variable.
escape_sgml_chars — escape special SGML characters in a string.
escape_shell_command — escape shell metacharacters in a string.
escape_string — convert a string into escaped characters.
exit — terminate execution and child process
headers — set and parse HTTP headers.
html — construct html tagged text.
http_accept — Parse HTTP Accept header lines
import_keyvalue_pairs — Import an argument list into the named array
include — includes a file into the output stream without modification.
incr0 — increment a variable or set it to 1 if nonexistent.
inspect — Introspection command for Rivet configuration
lassign_array — Assign a list of values to array variables
lempty — Returns 1 if <list> is empty or 0 if it has any elements. This command emulates the TclX lempty command.
lmatch — Look for elements in <list> that match <pattern>
load_cookies — get any cookie variables sent by the client.
load_env — get the request's environment variables.
load_headers — get client request's headers.
load_response — load form variables into an array.
lremove — remove from a list elements matching one or more patterns
makeurl — construct url's based on hostname, port.
no_body — Prevents Rivet from sending any content.
parray — Tcl's parray with html formatting.
parse — parses a Rivet template file.
raw_post — get the unmodified body of a POST request sent by the client.
redirect — Interrupt processing and divert to a new URL
read_file — Read the entire contents of a file and return it as a string.
try — Catch error and exception conditions
unescape_string — unescape escaped characters in a string.
upload — handle a file uploaded by a client.
url_query — builds a URL query from parameter-value pairs
var — get the value of a form variable.
wrap — Split a string on newlines.
wrapline — Split the line into multiple lines by splitting on space characters
xml — XML Fragments creation
Examples and Usage
Rivet Tcl Packages
DIO - Database Interface Objects
DIO — Database Interface Objects
DIODisplay - Database Interface Objects Display Class
DIODisplay — Database Interface Objects Display Class
Session Package
Introduction
Requirements
Preparing To Use It
Example Usage
Using Sessions From Your Code
Session Configuration Options
Session Methods
Getting Additional Randomness From The Entropy File
Form: An HTML Form Fields Generation Utility
Introduction
form — a Tcl command object for creating HTML forms
Calendar Package
Introduction
Calendar — Utility class the builds and prints a calendar table
XmlCalendar — Prints XML formatted calendar tables
HtmlCalendar — Concrete class derived from XmlCalendar
AsciiGlyphs
Introduction
toGlyphs — print large ASCII glyphs
Example
RivetEntities
Introduction
encode — encode a string replacing every occurrence of characters for which an SGML entity exists
decode — decode an SGML encoded string replacing every entity with the corresponding character
The Form Broker
Introduction
FormBroker — Form broker object creator
Resources - How to Get Help
Mailing Lists
Newsgroup
Web Sites
Bug Tracking System
IRC
Editing Rivet Template Files
Rivet Internals
Initialization
RivetChan
The global Command
Page Parsing, Execution and Caching
Extending Rivet by developing C procedures implementing new commands
Debugging Rivet and Apache
Upgrading from mod_dtcl or NeoWebScript
mod_dtcl
NeoWebScript

List of Examples

1. Hello World
2. Generate a Colorful Table
3. Variable Access
4. File Upload
5. File Download
6. XML Messages and Ajax
7. A Calendar Utility

Document revision: $Revision: 1770196 $, last modified 2017-11-06 23:25:27+01:00$ by $Author: mxmanghi $.


Introduction to Apache Rivet

Apache Rivet is a system for creating dynamic web content via a programming language integrated with Apache Web Server. It is designed to be fast, powerful and extensible, consume few system resources, be easy to learn, and to provide the user with a platform that can also be used for other programming tasks outside the web (GUI's, system administration tasks, text processing, database manipulation, XML, and so on). In order to meet these goals, we have chosen the Tcl programming language to combine with the Apache Web Server.

In this manual, we aim to help get you started, and then writing productive code as quickly as possible, as well as giving you ideas on how to best take advantage of Rivet's architecture to create different styles of web site.

This documentation is focused on the current version of Rivet, but still a work in progress, and, like everything else about Apache Rivet, it is Free Software. If you see something that needs improving, and have ideas or suggestions, don't hesitate to let us know. If you want to contribute directly, better yet!

New commands in Rivet 2.3

Rivet 2.3 introduces 2 new commands ::rivet::exit and ::rivet::catch

  • ::rivet::exit was introduced to help mod_rivet to give the command exit a more sensible behavior within the context of the Apache HTTP Web Server. In fact the core command has become an alias of ::rivet::exit which interrupts the script execution and hands control to any AbortScript, completes the request and just before returning to the web server framework terminates the child process by calling Tcl_Exit
  • Since ::rivet::abort_page and ::rivet::exit interrupt a script execution returning a TCL_ERROR code any call to a catch construct would trap this error and AbortScript could be executed only by throwing the error condition again. We introduced the ::rivet::catch in order to simplify these operations. If any real error occurs the procedure returns 1 and fills the optional arguments with their expected values, otherwise execution is interrupted control passed on to AbortScript