WebPageStatCalcSummaryNode Function

Action

Calculates a node summary of all nodes that match the specified search criteria. Possible search parameters include: URL, content-type of the response, document load-type (load, cache-hit, suppressed), 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).

The return value is the number of nodes that have been used for the calculation of the summary node.

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

WebPageStatCalcSummaryNode(
   in sUrlFilter         : string optional,
   in sContentTypeFilter : string optional,
   in nMatch             : number optional,
   in nFlags             : number optional ): number;

Return value

The number of nodes that have been used for the calculation of the summary node.

Parameter Description
sUrlFilter String to which the actual URL is to be compared. The nMatch parameter specifies the comparison method. When this parameter is omitted (null or “”), no URL comparison is performed.
sContentTypeFilter String to which the actual content-type (server response) is to be compared. The nMatch parameter specifies the comparison method. When this parameter is omitted (null or “”) no content-type comparison is performed.
nMatch

Specify one of the following values (optional):

PAGE_STAT_MATCH_Exact (default)
Case-sensitive comparison.
PAGE_STAT_MATCH_ExactNoCase
Case-insensitive comparison.
PAGE_STAT_MATCH_Wildcard
The search string must either begin or end with a ‘*’ character, which matches everything. The remainder of the string is compared case-sensitively.
PAGE_STAT_MATCH_WildcardNoCase
The search string must either begin or end with a ‘*’ character, which matches everything. The rest of the string is compared case-insensitively.
PAGE_STAT_MATCH_RegExp
The search string is a regular expression. See the regular expression chapter for a description of Silk Performer regular expression capability.
nFlags

Specifies the various options used by the search for the nodes. When this parameter is omitted the default options specified by the call to WebSetOption(WEB_OPT_DETAILED_PAGE_STAT) are used. Otherwise specify one of the following values:

PAGE_STAT_FLAG_UseHtml
The search includes nodes of the document section of the page (commonly html documents).
PAGE_STAT_FLAG_UseEmbedded
The search includes nodes of the embedded section of the page (commonly images or scripts).
PAGE_STAT_FLAG_NodeTypeLoad
The search includes nodes that caused a request to be sent to the server (no cache hits and no suppressed documents).
PAGE_STAT_FLAG_NodeTypeCacheHit
The search includes nodes that have been found in the cache (full cache hit), so that no request to the server has been sent.
PAGE_STAT_FLAG_NodeTypeSuppress
The search includes nodes for which no request has been sent to the server, because they have been suppressed by the user (WebPageSuppress or WebSetDomainSuppress).
PAGE_STAT_FLAG_RedirChainOnlyFirst
The search only returns the first nodes 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). Any subsequent nodes of a redirection chain are not returned.
PAGE_STAT_FLAG_RedirChainOnlyLast
The search only returns the last nodes of a potential redirection chain. Any proceeding nodes of a redirection chain are not returned. This option can be used to only find documents that the browser can actually show to the user.

Example

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

  transaction TWeb
  var
    nNodes  : number;
    fValue  : float;
  begin

    WebPageURL("http://lab3/");
    nNodes := WebPageStatCalcSummaryNode(null, "image/*",
              PAGE_STAT_MATCH_WildcardNoCase);
    if nNodes > 0 then
      WebPageStatGetNodeData(STATFLAG_BytesSent, fValue,
                             PAGE_STAT_Calculated);
      print("Bytes sent for images: " + string(fValue));
    end;
  end TWeb;