Consultor Eletrônico



Kbase 17778: State-Aware Web Objects And Time Outs With WebSpeed 2.x
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

FIX:

State-aware web objects that post to themselves (for example, when you generate SpeedScript or map HTML web objects) display the following error message when the agent that they have locked has timed out:
Application Error
The Web object to which you were attached has timed-out.
Please start again.

This is the default behavior. If you do not want this default behavior, you can either override the default adm-timing-out event procedure or use a Timeout Handler.

Web objects that run embedded SpeedScript objects:

State-aware web objects that run embedded speedscript objects
(without posting to themselves, as with a hyperlink, for example)
do not display a time-out message. WebSpeed uses the next
available agent for the request.

If you want a web object to run only in a locked client, it
can directly check the state of the agent. If the agent is not
locked (or if the main web object is not in the state-aware
mode), you can opt to notify the user with a message.

For example, you could take the following steps:

(This example uses a mapped web object where a user can enter a
customer number and that customer's name is displayed when the
user submits. There is also a hyperlink on the mapped web
object that runs an embedded SpeedScript customer report.)

1)Map the following HTML:

<html>
<head>
<title>Customer Number</title>
</head>

<form method="POST">
<p>Customer Number <input type="text" size="20" name="T1"></p>
<p>Name <input type="text" size="20" name="T2"></p>
<p><ahref="http://pctest/scripts/wsisa.dll/custrpt.r">Customer
Report</a></p>
<p><input type="submit" name="B1" value="Submit"></p>

</form>
</body>
</html>

2) Add the following code to output-header of the mapped web
object to make it state-aware:

RUN set-web-state IN web-utilities-hdl (this-procedure,
5).

3) Add the following definition to the web object:

DEFINE NEW GLOBAL SHARED VARIABLE locked_wo_hdl AS
HANDLE.

4) Add the following code to process-web-request to display
the customer name on a submit:

/* after input-fields */
FIND customer WHERE customer.cust-num = INTEGER(get-field("t1"))
NO-LOCK NO-ERROR.
IF AVAILABLE customer THEN ASSIGN t2 = customer.name.

5) Create a local-initialize procedure which does the
following:

ASSIGN locked_wo_hdl = this-procedure.

6) Add the following code to the embedded web object:

DEFINE SHARED VAR locked_wo_hdl AS HANDLE.
DEFINE VAR lock-error AS LOGICAL.
DEFINE VAR w-state AS CHAR.

IF NOT VALID-HANDLE(locked_wo_hdl) THEN lock-error = TRUE.
ELSE DO:
RUN get-attribute IN locled_wo_hdl ("web-state":U) NO-ERROR.
w-state = RETURN-VALUE.
IF (ERROR-STATUS:ERROR = FALSE AND w-state = "state-aware":U) THEN
lock-error = FALSE.
ELSE lock-error = TRUE.
END.
IF lock-error THEN DO:
RUN timemess.r.
RETURN.
END.

7) Create timemess.r object to inform the user that the
agent they used has timed out. For example,

<html>
<head>
</head>
<body>

<h1 align="center"><br>
The agent that you were using has timed out.<br></h1>
Click here to re-start the application.

</body>
</html>

8) You could also use timemess.r as the Time-out Handler for
the web object so that when the agent times out the user
gets the same message when posting the object .as when
choosng the hyperlink.

In the main block of the web object add:

RUN set-attribute-list IN THIS-PROCEDURE
('Web-Timeout-Handler = timemess.r':U).

With the above example, a user is able to enter a customer number
and see the customer name display on submit. If the agent times
out and the user chooses submit, the timeout handler runs and
the following message is seen:

The agent that you were using has timed out

If the agent has timed out and the user chooses the Customer
Report hyperlink, the user sees the message:

The agent that you were using has timed out.