Sys.Net.WebRequestManager defaultExecutor 속성
업데이트: 2007년 11월
네트워크 요청을 실행하는 데 사용되는 기본 네트워크 실행자 형식을 가져오거나 설정합니다.
참고
클라이언트 API 속성에 대한 속성 값을 가져오거나 설정하려면 이름에 get_ 및 set_ 접두사가 붙은 속성 접근자 메서드를 호출해야 합니다. 예를 들어 cancel과 같은 속성의 값을 가져오거나 설정하려면 get_cancel 또는 set_cancel 메서드를 호출합니다.
var dExecutor = Sys.WebRequestManager.get_defaultExecutorType ();
Sys.Net.WebRequestManager.set_defaultExecutorType(value);
매개 변수
매개 변수 |
설명 |
---|---|
value |
WebRequestExecutor 클래스 구현에 대한 참조입니다. |
예외
예외 형식 |
조건 |
---|---|
잘못된 매개 변수가 전달된 경우 |
반환 값
기본 웹 요청 실행자를 나타내는 개체입니다.
설명
defaultExecutor 속성을 사용하면 현재 WebRequestExecutor 개체에 대한 참조를 나타내는 기본 실행자를 가져오거나 설정할 수 있습니다.
WebRequestExecutor 개체에서는 웹 요청을 실행자에 보낼 때 사용자가 제공한 요청 실행자를 사용합니다. 실행자를 제공하지 않으면 WebRequestExecutor에서는 XmlHttpExecutor 클래스의 인스턴스를 만듭니다.
예제
다음 예제에서는 defaultExecutorType 속성을 사용하여 기본 실행자를 가져오고 설정하는 방법을 보여 줍니다. 이 코드는 WebRequestManager 클래스 개요에서 볼 수 있는 전체 예제의 일부입니다.
// Gets and sets the default executor.
function DefaultExecutor()
{
// Clear the previous results.
resultElement.innerHTML = "";
// Get system default executor type.
var sysDefaultExecutor =
Sys.Net.WebRequestManager.get_defaultExecutorType();
alert("Get default executor:" + sysDefaultExecutor);
// Modify the default executor type.
Sys.Net.WebRequestManager.set_defaultExecutorType(
"Sys.Net.CustomExecutor");
var customDefaultExecutor =
Sys.Net.WebRequestManager.get_defaultExecutorType();
alert("Set default executor: " + customDefaultExecutor);
// Set the executor back to the system default. This is
// to allow the WebRequest script to run.
executor = "Sys.Net.XMLHttpExecutor";
Sys.Net.WebRequestManager.set_defaultExecutorType(
sysDefaultExecutor);
}