MATLAB ヘルプ センター
クラス: matlab.net.http.Message 名前空間: matlab.net.http
メッセージ ヘッダーへのフィールドの追加
msg = addFields(msg,fields)
msg = addFields(msg,fName,fValue)
msg = addFields(msg,fName1,fValue1,...,fNameN,fValueN)
msg = addFields(msg,index,___)
msg = addFields(msg,fields) は fields を各メッセージのヘッダーの最後に追加し、更新されたメッセージを返します。
msg
fields
addFields は重複フィールドがあるかどうかをチェックしませんが、RequestMessage の send メソッドおよび complete メソッドは不適切な重複を拒否することがあります。
addFields
RequestMessage
send
complete
send メソッドまたは complete メソッドが特定のヘッダー フィールドを自動的に追加しないようにするには、そのフィールドについて、空 ([]) の Value プロパティを指定して addFields を呼び出します。
[]
Value
例
msg = addFields(msg,fName,fValue) は、名前 fName と値 fValue をもつフィールドを追加します。
fName
fValue
msg = addFields(msg,fName1,fValue1,...,fNameN,fValueN) は、fName と fValue のペアの引数で指定されるフィールドを、指定された順序で追加します。
msg = addFields(msg,index,___) は index の位置にフィールドを挿入し、前述の構文に任意の入力引数を含めることができます。
index
すべて展開する
matlab.net.http.Message
メッセージ。matlab.net.http.Message オブジェクトとして指定します。
matlab.net.http.HeaderField
追加するフィールド。1 つ以上の matlab.net.http.HeaderField オブジェクトのベクトルまたはコンマ区切りリストとして指定します。
例: matlab.net.http.HeaderField('Accept','text/plain')
matlab.net.http.HeaderField('Accept','text/plain')
ヘッダー フィールド名。string として指定します。
例: 'Accept'
'Accept'
ヘッダー フィールド値。string または fName に有効なタイプとして指定します。フィールドに既定値を使用するには、fValue を '' に設定します。最後の値がない場合は、[] と指定するのと同じになります。
''
例: 'text/plain'
'text/plain'
メッセージ ヘッダー内の位置。整数として指定します。index がヘッダーの長さよりも大きいか、または index が 0 の場合、メソッドは最後にフィールドを追加します。index が負数の場合、メソッドはヘッダーの最後からカウントします。
例: -1 は最後のフィールドの前に fields を挿入します。
-1
値 'text/plain' をもつ Accept ヘッダー フィールドを作成し、既定の要求メッセージに追加します。
field = matlab.net.http.HeaderField('Accept','text/plain'); m = matlab.net.http.RequestMessage('get'); msg = addFields(m,field); show(msg)
GET Accept: text/plain
2 つのヘッダー フィールドを要求メッセージに追加します。
m = matlab.net.http.RequestMessage('get'); msg = addFields(m,'Accept','text/plain','Cache-Control','no-store, no-cache'); show(msg)
GET Accept: text/plain Cache-Control: no-store, no-cache
2 つのヘッダー フィールドを含む要求メッセージを作成します。
m = matlab.net.http.RequestMessage('get'); msg = addFields(m,'Accept','text/plain','Cache-Control','no-store, no-cache');
メッセージの最後のヘッダー フィールドの前に、Content-Type ヘッダー フィールドを挿入します。
f = matlab.net.http.HeaderField('Content-Type','text/plain'); msg = addFields(msg,-1,f); show(msg)
GET Accept: text/plain Content-Type: text/plain Cache-Control: no-store, no-cache
R2016b で導入
matlab.net.http.HeaderField | matlab.net.http.RequestMessage
matlab.net.http.RequestMessage
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 のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ