Sys.Net.WebRequest executor Property
Gets or sets the executor of the associated Sys.Net.WebRequest instance.
To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.
var executor = MyWebRequest.get_executor();
The current WebRequestExecutor instance.
After the WebRequest instance has finished executing, the executor property returns the active network executor associated with the request. You can programmatically access the WebRequest instance from the associated executor.
You set the executor property only if you need a custom network executor. If you do not set this property, the system uses the default Sys.Net.XmlHttpExecutor executor, which is set after the invoke method is called.
You cannot set the executor property if the WebRequest instance already has an associated executor and the Web request has already been issued. If you try to set the executor property by using an executor that is already associated with the request instance, such as myRequest.set_executor(myRequest.get_executor()), an exception is thrown.
The following example shows how to set the executor. This code is part of a complete example found in the WebRequest class overview.
// This function sets the Web request
// executor, replacing the default one.
// Instantiate the WebRequest.
var wRequest = new Sys.Net.WebRequest();
// Create the executor. In this case it is an
// XMLHttpExecutor, equivalent to the default
// executor. But, you can create a custom one.
var executor = new Sys.Net.XMLHttpExecutor();
// Set the executor, replacing the default one.
// In this case the executor is equivalent to the
// default one.
// Get the current executor
var executor =
alert("Response availabe: " + executor.get_responseAvailable())