Class Page
Extends
CompositionItem.
Constructor Attributes | Constructor Name and Description |
---|---|
Page()
Represents a Page within the Composition.
|
Field Attributes | Field Name and Description |
---|---|
{String} |
If this Page has dynamic resources enabled, this property contains the
list of HTTP Headers that will be added for the dynamic resources that
will be retrieved.
|
{String[]} |
If this Page has dynamic resources enabled, this property contains the
list of resource links for the dynamic resources that will be retrieved.
|
{String} |
The value "Page".
|
- Fields borrowed from class CompositionItem:
- children, completionType, failureText, forEachValue, hasErrorEvents, index, name, nextItem, parent, path, playNumber, playNumberBeforeRenewal, playNumberWithinRenewal, previousItem, propertyList, REPEAT_DISTRIBUTION_CONSTANT, REPEAT_TIMING_PARALLEL, REPEAT_TIMING_SERIAL, REPEAT_TYPE_COUNT_CONSTANT, repeatIndex, systemPropertyList
- Methods borrowed from class CompositionItem:
- clearRepeat, end, endRepeat, getChild, getItemViaPath, setRepeat
This string can be modified by Script to change the headers that will be sent. By default, the "User-Agent" header is copied from the Main Message"s request.
The value of this property is available only after the Page"s "main Message" ("HTML Document") has played. Any changes made to this property must be made after that point (any changes made to this property before the main Message plays will be overwritten). In other words, this property should generally only be used by Scripts that appear after the main Message in the Page.
If dynamic resource retrieval has been disabled for the Page, this property is ignored and will have no value, and any value set into it will be ignored.
Here"s an example of a Script that adds the header "MyHeader", with value "123" to every dynamic resource Message in the Page.
var headers = $context.currentPage.dynamicResourceHeaders;
if (headers == null)
headers = "MyHeader: 123";
else
headers += "\nMyHeader: 123";
$context.currentPage.dynamicResourceHeaders = headers;
This array can be modified by Script to change the dynamic resources that will be retrieved. URLs in the array can be modified or removed, and new URLs can be added to the array. Null and undefined entries in the array will be ignored (therefore an entry in the array can be "removed" by setting it to null).
The value of this property is available only after the Page"s "main Message" ("HTML Document") has played. Any changes made to this property must be made after that point (any changes made to this property before the main Message plays will be overwritten). In other words, this property should generally only be used by Scripts that appear after the main Message in the Page.
If dynamic resource retrieval has been disabled for the Page, this property is ignored and will have no value, and any value set into it will be ignored.
Here"s an example of a Script that uses the "dynamicResourceLinks" property to process the list of links that were extracted from the response to the Page"s main Message, and do the following: (1) remove any resource links that contain the string ".css" anywhere in them, and (2) change the first occurrence of "https" to "http" in all links, and (3) add an additional hard-coded link to "http://somewhere.com/addedlink" to the list.
var links = $context.currentPage.dynamicResourceLinks;
if (links != null)
{
for (var i = 0; i < links.length; i++)
{
if (links[i].indexOf(".css") >= 0)
links[i] = null;
else
links[i].replace(/https/, "http");
}
links[links.length] = "http://somewhere.com/addedlink";
}
else
{
links = new Array();
links[0] = "http://somewhere.com/addedlink";
}
$context.currentPage.dynamicResourceLinks = links;