JavascriptCallbackBehaviorAttribute 클래스

정의

URL 쿼리 문자열 매개 변수 이름을 기본값인 “callback” 이외의 다른 이름으로 설정할 수 있도록 하는 계약 동작입니다.

public ref class JavascriptCallbackBehaviorAttribute sealed : Attribute, System::ServiceModel::Description::IContractBehavior
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)]
public sealed class JavascriptCallbackBehaviorAttribute : Attribute, System.ServiceModel.Description.IContractBehavior
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=false)>]
type JavascriptCallbackBehaviorAttribute = class
    inherit Attribute
    interface IContractBehavior
Public NotInheritable Class JavascriptCallbackBehaviorAttribute
Inherits Attribute
Implements IContractBehavior
상속
JavascriptCallbackBehaviorAttribute
특성
구현

설명

JSONP는 웹 브라우저에서 사이트 간 스크립팅을 지원하는 데 사용되는 메커니즘입니다. 이 메커니즘을 사용하려면 URL 쿼리 문자열 매개 변수 값으로 제공된 콜백 함수 이름과 함께 요청을 보내야 합니다. 이 서비스는 제공된 콜백 함수에 대한 호출에 래핑된 일반적인 JSON 페이로드를 마치 실행 코드 줄인 것처럼 사용하여 응답을 반환합니다.

http://baseAddress/Service/RESTService?callback=functionName은 서비스를 호출하는 데 사용되는 URL의 예입니다. 이 서비스는 호출되면 다음 JSON을 사용하여 응답합니다.

functionName({ "root":"Something});  

개발자는 JavascriptCallbackBehaviorAttribute를 사용하여 콜백 매개 변수로 해석할 URL 쿼리 문자열 매개 변수의 이름을 지정할 수 있습니다. 기본값은 "callback" (없습니다 대/소문자 구분).

다음 예제에서는 서비스 계약에 이 특성을 적용하는 방법을 보여 줍니다.

[ServiceContract]  
[JavascriptCallbackBehavior]  
public class Service1  
{  
    [OperationContract]  
    [WebGet(ResponseFormat=WebMessageFormat.Json)]  
    public string GetData()  
    {              
         // ...  
    }  
}  

사용 되는 서비스 계약 형식을 표시 하는 경우에이 특성이 적용 합니다 WebHttpBinding 하며 CrossDomainScriptAccessEnabled 바인딩의 속성 true합니다.

생성자

JavascriptCallbackBehaviorAttribute()

JavascriptCallbackBehaviorAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)
UrlParameterName

도메인 간 스크립트 액세스에 사용할 URL 쿼리 문자열 매개 변수 이름을 가져오거나 설정합니다.

메서드

AddBindingParameters(ContractDescription, ServiceEndpoint, BindingParameterCollection)

AddBindingParameters(ContractDescription, ServiceEndpoint, BindingParameterCollection) 메서드의 구현입니다.

ApplyClientBehavior(ContractDescription, ServiceEndpoint, ClientRuntime)

ApplyClientBehavior(ContractDescription, ServiceEndpoint, ClientRuntime) 메서드의 구현입니다.

ApplyDispatchBehavior(ContractDescription, ServiceEndpoint, DispatchRuntime)

ApplyDispatchBehavior(ContractDescription, ServiceEndpoint, DispatchRuntime) 메서드의 구현입니다.

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Validate(ContractDescription, ServiceEndpoint)

Validate(ContractDescription, ServiceEndpoint) 메서드의 구현입니다.

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상