"interceptRequest"

This event is triggered before a WebView EWO sends a network request and allows request-specific header handling.

Synopsis

void interceptRequest(mapping params)

Parameters

Parameter Description
params Request metadata for the current request. The key requestUrl contains the requested URL.

Details

Use this event to set "additionalRequestHeaders" depending on params["requestUrl"].

The event function must use return type void.

This event does not automatically transfer browser cookies into customer-defined requests. Set required request headers explicitly in the event logic.

Restriction:
Asynchronous CTRL calls are not supported in this event (for example dpGet() and delay()). Such calls can produce warning messages and do not provide valid async results in this context.
void interceptRequest(mapping params)
{
  string reqUrl = params["requestUrl"];

  if (reqUrl.startsWith("http://localhost:9991/"))
    WebView_ewo1.additionalRequestHeaders = makeDynString("User-Agent: Agent9991");
  else
    WebView_ewo1.additionalRequestHeaders = makeDynString("User-Agent: Agent9992");
}

Assignment

WebView EWO