도움말 센터도움말 센터
클래스: 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
추가할 필드로, 벡터로 지정되거나 하나 이상의 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
두 개의 헤더 필드를 요청 메시지에 추가합니다.
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
두 개의 헤더 필드를 가진 요청 메시지를 만듭니다.
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
이 예제의 수정된 버전이 있습니다. 사용자가 편집한 내용을 반영하여 이 예제를 여시겠습니까?
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office