Class Index

Classes


Class Target


Extends CompositionItem.

Class Summary
Constructor Attributes Constructor Name and Description
 
Target()
Represents a Target within the Composition.
Field Summary
Field Attributes Field Name and Description
{object[]}  
This property contains the current list of cookies being maintained.
{integer}  
Always 0 for Targets.
{integer}  
Always 0 for Targets.
{integer}  
Always 0 for Targets.
{integer}  
Always -1 for Targets.
{String}  
The value "Target".
Fields borrowed from class CompositionItem:
children, completionType, failureText, forEachValue, hasErrorEvents, index, name, nextItem, parent, path, previousItem, propertyList, REPEAT_DISTRIBUTION_CONSTANT, REPEAT_TIMING_PARALLEL, REPEAT_TIMING_SERIAL, REPEAT_TYPE_COUNT_CONSTANT, systemPropertyList
Method Summary
Method Attributes Method Name and Description
{anything}  
accessor(accessorName, parameters)
Executes an "Application Accessor" for this Target.
{Target}  
If this Target was merged into a parent Clip due to Target Merging, this returns the Target object for the Target that it was merged into.
{boolean}  
Returns true if one or more Targets in one or more child nested Clips have been merged into this Target due to Target merging.
{boolean}  
Returns true if this Target was originally in a child nested Clip but was adopted by the current Clip due to Target Merging.
{boolean}  
Returns true if this Target was merged into a parent Clip due to Target Merging.
{String}  
signURL(url)
"Signs" a URL according to the OAuth ("Open Authorization") protocol.
Methods borrowed from class CompositionItem:
clearRepeat, end, endRepeat, getChild, getItemViaPath, setRepeat
Class Detail
Target()
Represents a Target within the Composition.
Field Detail
{object[]} cookies
This property contains the current list of cookies being maintained. This list changes as responses are received that contain cookies.

The value is null if there are currently no cookies being maintained.

There is a single list of cookies maintained across all Targets within the same instance of the same Clip. Thus the value for this property will be the same for all Targets in the same instance of the same Clip, and setting this property affects the Clip's cookie processing across all Targets within the Clip.

This property can be set to replace the entire list of cookies. This can be done by modifying the existing list, or by creating an entirely new list.

The value of the property is an array of Objects. Each object in the array has the following property values:

Here is an example Script that retrieves the current cookie values and displays them in the Result:

var cookies = $context.currentClip.targets[0].cookies;
if (cookies == null)
{
  $context.result.postMessage($context.result.LEVEL_INFO, "No cookies.");
}
else
{
  var text = "";
  for each (var cookie in cookies))
  {
    text += "name=" + cookie.name + ", ";
    text += "domain=" + cookie.domain + ", ";
    text += "path=" + cookie.path + ", ";
    text += "value=" + cookie.value + ", ";
    text += "expirationDate=" + cookie.expirationDate + ", ";
    text += "secure=" + cookie.secure + "\n";
  }

  $context.result.postMessage($context.result.LEVEL_INFO, cookies.length + " cookies.", text);
}

Here is an example Script that replaces the entire current cookie list with a new list that contains two cookies named "MyCookie1" and "MyCookie2":

var newList = new Array();

var cookie = new Object();
cookie.name = "MyCookie1";
cookie.domain = "myhostname";
cookie.path = "/some/path";
cookie.value = "Value of MyCookie1";
cookie.expirationDate = new Date("05 Aug 2030 00:00:00 GMT");
cookie.secure = false;
newList[0] = cookie;

cookie = new Object();
cookie.name = "MyCookie2";
cookie.domain = "myhostname";
cookie.path = "/some/path";
cookie.value = "Value of MyCookie2";
cookie.expirationDate = new Date("05 Aug 2030 00:00:00 GMT");
cookie.secure = false;
newList[1] = cookie;
$context.currentClip.targets[0].cookies = newList;

Here is an example Script that finds the current cookie named "ChocolateChip" and changes it's value to "42":

var list = $context.currentClip.targets[0].cookies;

if (list != null)
{
  for each (var cookie in list)
  {
    if (cookie.name == "ChocolateChip")
    {
      cookie.value = "42";
      $context.result.postMessage($context.result.LEVEL_INFO, "Cookie value replaced.");
      break;
    }
  }
}

$context.currentClip.targets[0].cookies = list;

Here is an example Script that adds a new cookie named "ChocolateChip" to the current cookie list:

var list = $context.currentClip.targets[0].cookies;

if (list == null)
  list = new Array();

var cookie = new Object();
cookie.name = "ChocolateChip";
cookie.domain = "myhostname";
cookie.path = "/my/path";
cookie.value = "Cookie value";
cookie.expirationDate = new Date("05 Aug 2030 00:00:00 GMT");
cookie.secure = false;

list[list.length] = cookie;

$context.currentClip.targets[0].cookies = list;


{integer} playNumber
Always 0 for Targets.

Read only.


{integer} playNumberBeforeRenewal
Always 0 for Targets.

Read only.


{integer} playNumberWithinRenewal
Always 0 for Targets.

Read only.


{integer} repeatIndex
Always -1 for Targets.

Read only.


{String} type
The value "Target". Read only.
Method Detail
{anything} accessor(accessorName, parameters)
Executes an "Application Accessor" for this Target.
Parameters:
{String} accessorName

The name of the Accessor to be executed.

{anything} parameters

The types and number of parameters following the name depends upon the Accessor.

Returns:
{anything}

The value returned depends upon the Accessor.


{Target} getDirectTarget()
If this Target was merged into a parent Clip due to Target Merging, this returns the Target object for the Target that it was merged into.

If it was merged into several levels of nested Clips above, the highest-level Target is returned.

If this Target was not merged into a parent Clip, this Target object itself is returned.

Returns:
{Target}

The Target object for the Target that this Target was merged into. Null if this Target was not merged.


{boolean} hasBeenMergedInto()
Returns true if one or more Targets in one or more child nested Clips have been merged into this Target due to Target merging.

Most operations on this Target will also affect the original Targets in the child nested Clips. For example, changing a System Property for this Target will also change the same System Property of the original Targets in the child Clips. One notable exception is Custom Properties -- this Target will still maintain it's own set of Custom Properties, separate from the original Targets in the child Clips.

Returns:
{boolean}

true if one or more Targets in one or more child nested Clips have been merged into this Target due to Target merging.


{boolean} isAdopted()
Returns true if this Target was originally in a child nested Clip but was adopted by the current Clip due to Target Merging.

Most operations on this Target will also affect the original Target in the child nested Clip. For example, changing a System Property for this Target will also change the same System Property of the original Target in the child Clip. One notable exception is Custom Properties -- this Target will still maintain it's own set of Custom Properties, separate from the original Target in the child Clip.

Returns:
{boolean}

True if this Target was originally in a child nested Clip but was adopted by the current Clip due to Target Merging.


{boolean} isIndirect()
Returns true if this Target was merged into a parent Clip due to Target Merging.

Most operations on this Target will be deferred to the adoptive Target in the parent Clip. For example, changing a System Property for this Target will also change the same System Property of the adoptive Target in the parent Clip. One notable exception is Custom Properties -- this Target will still maintain it's own set of Custom Properties, separate from the adoptive Target in the parent Clip.

Returns:
{boolean}

True if this Target was merged into a parent Clip due to Target Merging.


{String} signURL(url)
"Signs" a URL according to the OAuth ("Open Authorization") protocol.

The information needed to perform the signing operation is taken from the following System Property values of the Target:

Parameters:
{String} url

A complete HTTP URL.

Returns:
{String}

A modified version of the URL, "signed" according to OAuth.


SOASTA CloudTest Script Documentation (build 8744.736). Copyright 2006-2011. All rights reserved.