| 패키지 | flash.net |
| 클래스 | public final class URLRequestMethod |
| 상속 | URLRequestMethod Object |
| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0, Flash Player 9, Flash Lite 4 |
POST 메서드를 사용해야 하는지 아니면 GET 메서드를 사용해야 하는지를 지정하는 값을 제공합니다.
관련 API 요소
공용 속성
공용 메서드
공용 상수
| 상수 | 정의 주체 | ||
|---|---|---|---|
| DELETE : String = "DELETE" [정적]
URLRequest 객체가 DELETE임을 지정합니다. | URLRequestMethod | ||
| GET : String = "GET" [정적]
URLRequest 객체가 GET임을 지정합니다. | URLRequestMethod | ||
| HEAD : String = "HEAD" [정적]
URLRequest 객체가 HEAD임을 지정합니다. | URLRequestMethod | ||
| OPTIONS : String = "OPTIONS" [정적]
URLRequest 객체가 OPTIONS임을 지정합니다. | URLRequestMethod | ||
| POST : String = "POST" [정적]
URLRequest 객체가 POST임을 지정합니다. | URLRequestMethod | ||
| PUT : String = "PUT" [정적]
URLRequest 객체가 PUT임을 지정합니다. | URLRequestMethod | ||
상수 세부 정보
DELETE | 상수 |
public static const DELETE:String = "DELETE"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0 |
URLRequest 객체가 DELETE임을 지정합니다.
GET | 상수 |
public static const GET:String = "GET"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0, Flash Player 9, Flash Lite 4 |
URLRequest 객체가 GET임을 지정합니다.
HEAD | 상수 |
public static const HEAD:String = "HEAD"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0 |
URLRequest 객체가 HEAD임을 지정합니다.
OPTIONS | 상수 |
public static const OPTIONS:String = "OPTIONS"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0 |
URLRequest 객체가 OPTIONS임을 지정합니다.
POST | 상수 |
public static const POST:String = "POST"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0, Flash Player 9, Flash Lite 4 |
URLRequest 객체가 POST임을 지정합니다.
참고: 현재 Adobe AIR에서 실행 중인 내용의 경우 navigateToURL() 함수를 사용하면 런타임에서는 해당 method 속성이 URLRequestMethod.POST로 설정된 POST 메서드를 사용하는 URLRequest가 GET 메서드를 사용하는 것으로 간주합니다.
PUT | 상수 |
public static const PUT:String = "PUT"| 언어 버전: | ActionScript 3.0 |
| 런타임 버전: | AIR 1.0 |
URLRequest 객체가 PUT임을 지정합니다.
예제 예제 사용 방법
URLRequestMethodExample.as
다음 예제에서는 로컬 텍스트 파일의 데이터를 로드하여 표시합니다. 또한 이벤트 처리 정보도 추적합니다.
참고: 이 예제를 실행하려면 example.txt라는 이름의 파일을 SWF 파일과 같은 디렉토리에 넣어야 합니다. 이 파일은 몇 개의 단어나 텍스트 행으로 구성된 간단한 텍스트 파일이어야 합니다.
이 예제 코드는 다음 작업을 수행합니다.
- 생성자 함수는
loader라는 이름의 URLLoader 인스턴스를 만듭니다. loader객체는configureListeners()메서드에 전달되고, 이 메서드는 지원되는 각 URLLoader 이벤트에 대해 리스너를 추가합니다.request라는 이름의 URLRequest 인스턴스가 만들어지며, 이 인스턴스는 로드할 파일 이름을 지정합니다.- 이 요청의
method속성은URLRequestMethod.POST로 설정됩니다. - 그런 다음
request객체가loader.load()에 전달되고, 이 메서드는 해당 텍스트 파일을 로드합니다. - URLLoader가 텍스트 파일 로드를 완료하면
Event.COMPLETE이벤트가 발생하여completeHandler()메서드가 트리거됩니다.completeHandler()메서드는 단순히data속성, 즉 텍스트 파일의 내용을 추적합니다.
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.*;
public class URLRequestMethodExample extends Sprite {
private var loader:URLLoader;
public function URLRequestMethodExample() {
loader = new URLLoader();
configureListeners(loader);
var request:URLRequest = new URLRequest("example.txt");
request.method = URLRequestMethod.POST;
loader.load(request);
}
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
dispatcher.addEventListener(Event.OPEN, openHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
private function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
trace("completeHandler: " + loader.data);
}
private function openHandler(event:Event):void {
trace("openHandler: " + event);
}
private function progressHandler(event:ProgressEvent):void {
trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
}
private function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
private function httpStatusHandler(event:HTTPStatusEvent):void {
trace("httpStatusHandler: " + event);
}
private function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}
}
}
Tue Jun 12 2018, 03:17 PM Z
상속되는 공용 속성 숨기기
상속되는 공용 속성 표시