WebPageStatGetNodeInfo Function

Action

Returns information about a node (specified by the node ID) that is returned by a previous WebPageStatXXX function call. Possible return values are the URL, the content-type of the response, the document load-type (load, cache-hit, or suppressed), the document kind (html or embedded) and the location within a redirection chain (a redirection chain is created when a request is retried or reissued because of a redirection or an authentication request by the server).

To generally enable extended page statistics functionality, call WebSetOption with an option of WEB_OPT_DETAILED_PAGE_STAT (for a detailed description of the various values see WebSetOption).

Include file

WebAPI.bdh

Syntax

WebPageStatGetNodeInfo(
   out nNodeType    : number allownull,
   out sUrl         : string optional,
   out sContentType : string optional,
   out bHtml        : boolean optional,
   out bReload      : boolean optional,
   in  nNode        : number optional ): boolean;

Return value

  • true if the information is retrieved successfully

  • false otherwise

Parameter Description
nNodeType

Will be one of the following values:

PAGE_STAT_FLAG_NodeTypeLoad
Node caused a request to the server (no cache hits and no suppressed documents).
PAGE_STAT_FLAG_NodeTypeCacheHit
Node found in the cache (full cache hit), so that no request to the server has been sent.
PAGE_STAT_FLAG_NodeTypeSuppress
No request has been sent to the server for this node because it has been suppressed by the user (WebPageSuppress or WebSetDomainSuppress).

If this value is not of interest, null can be specified.

sUrl

Returns the URL of the node.

If this value is not of interest, it can be omitted. Or null can be specified.

sContentType

Returns the content-type (server response) of the node.

If this value is not of interest, it can be omitted. Or null can be specified.

bHtml

Returns whether the node belongs to the document section of the page (normally html) or to the embedded section (normally an image or a script).

If this value is not of interest, it can be omitted. Or null can be specified.

bReload Returns if the node is not the first document of a potential redirection chain (a redirection chain is created when a request is retried or reissued because of a redirection or an authentication request by the server).
nNode Specify the node ID of the node for which information is to be returned (possibly returned by a previous WebPageStatXXX function). Provide a value of PAGE_STAT_Calculated if data of the most recent calculated node should be returned (WebPageStatCalcSummaryNode). When this parameter is omitted, the most recently returned or calculated node is used.

Example

dcltrans
  transaction TInit
  begin
    WebSetOption(WEB_OPT_DETAILED_PAGE_STAT,
                PAGE_STAT_FLAG_AllLoadedDocs);
  end TInit;

  transaction TWeb
  var
    nNode  : number;
    nType  : number;
    sUrl   : string;
    sCT    : string;
    bReload: boolean;
    fValue : float;
  begin
    WebPageUrl("http://lab3/");
    nNode := WebPageStatGetRootNode();
    if nNode > 0 then
      WebPageStatGetNodeInfo(nType, sUrl, sCT, null, bReload, nNode);
      WebPageStatGetNodeData(STATFLAG_TimerServerBusy, fValue);
      print("Type: " + string(nType));
      print("Url: " + sUrl);
      print("Content type: " + sCT);
      if bReload then
        print("root doc needed more than one request");
      end;
      print("ServerBusyTime [s]: " + string(fValue));
    end;
  end TWeb;