Sys.Net.WebRequest executor 속성

업데이트: 2007년 11월

연결된 Sys.Net.WebRequest 인스턴스의 실행자를 가져오거나 설정합니다.

참고

클라이언트 API 속성에 대한 속성 값을 가져오거나 설정하려면 이름에 get_set_ 접두사가 붙은 속성 접근자 메서드를 호출해야 합니다. 예를 들어 cancel과 같은 속성의 값을 가져오거나 설정하려면 get_cancel 또는 set_cancel 메서드를 호출합니다.

var executor = MyWebRequest.get_executor();
myRequest.set_Executor(value);

매개 변수

매개 변수

설명

value

Sys.Net.WebRequestExecutor에서 파생되는 클래스의 인스턴스입니다.

반환 값

현재 WebRequestExecutor 인스턴스입니다.

예외

예외 형식

조건

Sys.ArgumentNullException

value가 null인 경우

Sys.InvalidOperationException

실행자가 활성화된 후에 설정된 경우

Sys.ArgumentException

value가 올바른 WebRequestExecutor 형식이 아닌 경우

설명

WebRequest 인스턴스의 실행이 끝나면 executor 속성은 요청과 연결된 활성 네트워크 실행자를 반환합니다. 그러면 연결된 실행자에서 프로그래밍 방식으로 WebRequest 인스턴스에 액세스할 수 있습니다.

사용자 지정 네트워크 실행자가 필요한 경우에만 executor 속성을 설정합니다. 이 속성을 설정하지 않으면 invoke 메서드가 호출된 후에 설정되는 기본 Sys.Net.XmlHttpExecutor 실행자가 사용됩니다.

WebRequest 인스턴스에 이미 실행자가 연결되어 있고 웹 요청이 발생된 경우에는 executor 속성을 설정할 수 없습니다. myRequest.set_executor(myRequest.get_executor())와 같이 요청 인스턴스와 이미 연결되어 있는 실행자를 사용하여 executor 속성을 설정하려고 하면 예외가 throw됩니다.

예제

다음 예제에서는 실행자를 설정하는 방법을 보여 줍니다. 이 코드는 WebRequest 클래스 개요에서 볼 수 있는 전체 예제의 일부입니다.

// This function sets the Web request
// executor, replacing the default one.
function WebRequestExecutor()
{     
    // 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.
    wRequest.set_executor(executor); 

    // Get the current executor       
    var executor =  
        wRequest.get_executor();

    alert("Response availabe: " + executor.get_responseAvailable())
}

참고 항목

참조

Sys.Net.WebRequestManager 클래스

Sys.Net.WebRequestExecutor 클래스

Sys.Net.XMLHttpExecutor 클래스