HttpResponseMessageProperty 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供對 HTTP 回應的存取,以便存取並回應透過 HTTP 協定提出的額外請求資訊。
public ref class HttpResponseMessageProperty sealed : System::ServiceModel::Channels::IMessageProperty
public ref class HttpResponseMessageProperty sealed : System::ServiceModel::Channels::IMergeEnabledMessageProperty, System::ServiceModel::Channels::IMessageProperty
public ref class HttpResponseMessageProperty sealed
public sealed class HttpResponseMessageProperty : System.ServiceModel.Channels.IMessageProperty
public sealed class HttpResponseMessageProperty : System.ServiceModel.Channels.IMergeEnabledMessageProperty, System.ServiceModel.Channels.IMessageProperty
public sealed class HttpResponseMessageProperty
type HttpResponseMessageProperty = class
interface IMessageProperty
type HttpResponseMessageProperty = class
interface IMessageProperty
interface IMergeEnabledMessageProperty
type HttpResponseMessageProperty = class
Public NotInheritable Class HttpResponseMessageProperty
Implements IMessageProperty
Public NotInheritable Class HttpResponseMessageProperty
Implements IMergeEnabledMessageProperty, IMessageProperty
Public NotInheritable Class HttpResponseMessageProperty
- 繼承
-
HttpResponseMessageProperty
- 實作
-
IMessageProperty System.ServiceModel.Channels.IMergeEnabledMessageProperty
範例
此說明如何使用建立類別實例 HttpResponseProperty 並修改部分成員:
HttpResponseMessageProperty responseProperty =
new HttpResponseMessageProperty();
responseProperty.StatusCode = HttpStatusCode.OK;
responseProperty.Headers.Add(
HttpResponseHeader.ContentType,
"text/html; charset=UTF-8");
備註
這是一個通用類別,能直接存取 HTTP 回應資訊,可用於封裝 HTTP 特定資訊。 此類別的一個用途是支援依照表示狀態轉移(REST)架構實作的服務。
此課程能讓您支援以下情境:
控制實體實體是否被傳送。
允許為每個回應設定 HTTP 標頭(金鑰、值)對。
每個回應使用的狀態代碼和狀態描述會有所不同。
此類別可用於 HttpTransportBindingElement 相關類別。
建構函式
| 名稱 | Description |
|---|---|
| HttpResponseMessageProperty() |
初始化 HttpResponseMessageProperty 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| Headers |
從 HTTP 回應取得 HTTP 標頭。 |
| HttpResponseMessage |
提供對 HTTP 回應的存取,以便存取並回應透過 HTTP 協定提出的額外請求資訊。 |
| Name |
取得與 HttpResponseMessageProperty 類別相關聯的訊息屬性名稱。 |
| StatusCode |
取得或設定該屬性所附加的當前 HTTP 回應的狀態碼。 |
| StatusDescription |
取得或設定該屬性所附加的當前 HTTP 回應的狀態碼描述。 |
| SuppressEntityBody |
取得或設定一個值,指示訊息主體是否被忽略並發送空訊息。 |
| SuppressPreamble |
是否抑制訊息前言,取得或設定。 |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |
明確介面實作
| 名稱 | Description |
|---|---|
| IMergeEnabledMessageProperty.TryMergeWithProperty(Object) |
提供對 HTTP 回應的存取,以便存取並回應透過 HTTP 協定提出的額外請求資訊。 |
| IMessageProperty.CreateCopy() |
建立目前實例的新副本。 |