Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling WebSpeed Transactions : Handling state-aware time-outs : Using a Web object time-out handler
 

Using a Web object time-out handler

To use a time-out handler for a Web object, set the Web-Timeout-Handler attribute to the name of a procedure or Web object that you want to run when the state-aware Web object times-out. You only need to set this attribute once, so the best place to set the attribute is in the Main Code Block or a local initialize event procedure for the Web object.
Set the attribute using the set-attribute-list method procedure:
RUN set-attribute-list IN THIS-PROCEDURE
  ('Web-Timeout-Handler=mytimeout.w':U).
The procedure specified as the Web-Timeout-Handler is stored both as the handle of the state-aware Web object and as part of its Web object cookie. This supports the situation where the state-aware Web object times-out and is deleted. Even if the Web object is deleted, the Web-Timeout-Handler can still be retrieved from the cookie.
Here is an example of HTTP headers generated by WebSpeed for a Web object containing the Web-Timeout-Handler attribute:
Set-Cookie: WSEU=demeter:5604:22744:0; path=/cgi-bin/timeoff.sh
Set-Cookie: task.w=97,login.w ; path=/cgi-bin/timeoff.sh
Set-Cookie: employee.ssn=000000000; path=/cgi-bin/timeoff.sh
Content-Type: text/html
As you can see, the Web-Timeout-Handler (login.w) is appended to the end of the Web object cookie, which contains the value of the SpeedScript UNIQUE-ID procedure attribute for the state-aware Web object.
After a time-out occurs, WebSpeed retrieves the time-out handler name from the cookie of the timed-out state-aware Web object during the next Web request and runs the procedure by that name. If the time-out handler procedure is itself an HTML-mapping Web object, note that WebSpeed executes the section of process-web-request that handles the appropriate request method, usually a POST.