Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling WebSpeed Transactions : Implementing transaction control : Modifying the outputHeader procedure
 

Modifying the outputHeader procedure

The outputHeader procedure is the standard place to make a Web object state aware. It performs similar transaction management functions for both HTML-mapping and CGI Wrapper Web objects.
The standard WebSpeed template for this procedure contains a set of comments and a call to the output-content-type API function:
output-content-type ("text/html":U).
The call to output-content-type is required and it outputs the standard MIME header for Web pages.
The comments prior to output-content-type describe how to call setWebstate (or set-web-state) and set-cookie in order to make the Web object state aware.
The setWebstate function sets the WebSpeed transaction state for the Web object. In this example, the calling Web object is made state aware with a time-out period of five minutes:
setWebState(5).
set-cookie ("custNum":U, "23":U, TODAY + 1, ?, ?, ?, ?).
output-content-type ("text/html":U).
To make the Web object state aware, setWebstate creates the cookies that identify the WebSpeed agent and the Web object. After a time-out, setWebstate kills the cookies.
The setWebstate function resides in install-path/src/web2/admweb.p. The Web object runs this super procedure persistently to provide access to many WebSpeed method procedures and API functions.
If you want to terminate the entire state-persistent WebSpeed transaction and unlock the agent, you must execute setWebstate with the time-out period set to zero.
Note: WebSpeed supports one other standard place to call setWebState, when handling state-aware time-outs. For more information, see Resetting a Web object's time-out period.
Although the setWebState function automatically creates the cookies that identify the WebSpeed agent, and the Web object, you may want to create additional cookies to pass other information. The set-cookie API function, called after setWebState, allows you to generate additional application cookies. You can call it as many times as needed to define all your cookies.
For example, the following sets a cookie, custNum=23:
setWebState(5).
set-cookie ("custNum":U, "23":U, TODAY + 1, ?, ?, ?, ?).
output-content-type ("text/html":U).
The cookie expires on the next day at midnight. Note that midnight is the default value if time is the Unknown value (?).
For more information, see Passing information between Web requests. For syntax information, see set-cookie .