removeFields
クラス: matlab.net.http.Message
名前空間: matlab.net.http
メッセージ ヘッダーからのフィールドの削除
入力引数
メッセージ。matlab.net.http.Message
オブジェクトとして指定します。
一致させる名前。以下のいずれかとして指定します。
削除するフィールド名を含む string ベクトル、文字ベクトル、文字ベクトルの cell 配列、string または文字ベクトルのコンマ区切りリスト。名前は、大文字と小文字を区別しません。
削除するフィールド名を決定するために使用される
Name
プロパティをもつ 1 つ以上のHeaderField
オブジェクトのベクトルまたはコンマ区切りリスト。名前は、大文字と小文字を区別しません。ヘッダー フィールド値は無視されます。HeaderField
のサブクラスであるmatlab.metadata.Class
オブジェクトのベクトルまたはコンマ区切りリスト。removeFields
メソッドは、クラスにかかわらず、指定クラスでサポートされる名前と一致する名前を検索します。サポートされる名前の特定のセットがサブクラスにない場合、そのサブクラスのすべてのヘッダー フィールドが、名前にかかわらず一致します。サポートされる名前を表示するには、HeaderField.displaySubclasses
メソッドを呼び出します。
例: getFields(response,'Date','Content-Type')
例
2 つのヘッダー フィールド Cache-Control と Content-Type を含む要求メッセージを作成し、そのメッセージを表示します。
import matlab.net.http.HeaderField m = matlab.net.http.RequestMessage('get'); f1 = HeaderField('Cache-Control','no-store, no-cache'); f2 = HeaderField('Content-Type','text/html;charset=utf-8'); m = addFields(m,f1,f2); show(m)
GET Cache-Control: no-store, no-cache Content-Type: text/html;charset=utf-8
Cache-Control フィールドを削除して、更新されたメッセージを表示します。
msg = removeFields(m,'Cache-Control');
show(msg)
GET Content-Type: text/html;charset=utf-8
MediaRangeField
クラスには 2 つのサブクラス AcceptField
と ContentTypeField
があります。MediaRangeField
クラスを指定する ID は、MediaRangeField
クラス、AcceptField
クラスおよび ContentTypeField
クラスのすべてのフィールドと、Name
プロパティが 'Accept'
または 'Content-Type'
である任意のフィールドに一致します。
ContentTypeField
ヘッダー フィールドを含むメッセージ m
を作成します。
m = matlab.net.http.RequestMessage('get'); f = matlab.net.http.HeaderField('Content-Type','text/html;charset=utf-8'); m = addFields(m,f);
MediaRangeField
クラスのサブクラスであるすべてのヘッダー フィールドを削除して、更新されたメッセージを表示します。
id = ?matlab.net.http.field.MediaRangeField; msg = removeFields(m,id); show(msg)
GET
バージョン履歴
R2016b で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)