이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
getFields
클래스: matlab.net.http.Message
패키지: matlab.net.http
이름이나 클래스가 일치하는 메시지 헤더 필드 반환
입력 인수
messages
— 메시지
matlab.net.http.Message
객체의 벡터
메시지로, matlab.net.http.Message
객체로 구성된 벡터로 지정됩니다.
예: getFields([msg1,msg2],'Date')
ids
— 일치시킬 이름
문자열 | matlab.net.http.HeaderField
객체 | meta.class
객체
일치시킬 이름으로, 다음 중 하나로 지정됩니다.
반환할 필드의 이름을 포함하는 string형 벡터, 문자형 벡터, 문자형 벡터로 구성된 셀형 배열, string형 또는 문자형 벡터로 구성된 쉼표로 구분된 목록 중 하나. 이름은 대/소문자를 구분하지 않습니다.
하나 이상의
matlab.net.http.HeaderField
객체로 구성된 쉼표로 구분된 목록 또는 벡터. 반환할 필드는 이러한 객체의Name
속성을 사용하여 결정됩니다. 이름은 대/소문자를 구분하지 않습니다. 이러한 객체의 헤더 필드 값은 무시됩니다.HeaderField
의 서브클래스인meta.class
객체로 구성된, 쉼표로 구분된 목록이나 벡터.getFields
메서드는 지정된 클래스에 상관없이 이러한 클래스가 지원하는 이름과 일치하는 이름을 검색합니다. 서브클래스에 지원되는 특정 이름 집합이 없을 경우 해당 서브클래스의 모든 헤더 필드가 이름에 상관없이 일치됩니다. 지원되는 이름을 보려면HeaderField.displaySubclasses
메서드를 호출하십시오.
예: getFields(response,'Date','Content-Type')
출력 인수
fields
— 입력값과 일치하는 필드
matlab.net.http.HeaderField
객체로 구성된 배열
입력값과 일치하는 필드로, matlab.net.http.HeaderField
객체로 구성된 배열로 반환됩니다. 일치 항목이 없을 경우, getFields
는 빈 HeaderField
배열을 반환합니다. 이름 검색에서는 대/소문자를 구분하지 않습니다.
예제
요청 메시지에 추가된 필수 필드 확인하기
RequestMessage.complete
메서드를 사용하여 요청 메시지에 누락된 Date 헤더 필드를 추가합니다.
MathWorks® 웹 사이트에서 텍스트를 가져오도록 요청 메시지를 생성합니다.
uri = matlab.net.URI('https://www.mathworks.com');
req = matlab.net.http.RequestMessage;
메시지가 Date 필드를 포함하는지 확인합니다. 날짜 값에는 현재 사용 중인 시스템 정보가 반영됩니다. 값 indices{1} = []
은 req
에 Date 필드가 포함되어 있지 않음을 나타냅니다.
request = complete(req,uri); [fields,indices] = getFields([req,request],?matlab.net.http.field.HTTPDateField)
fields = DateField with properties: Name: "Date" Value: "Sat, 13 Aug 2022 00:13:41 GMT"
indices=1×2 cell array
{0x0 double} {[3]}
버전 내역
R2016b에 개발됨
MATLAB 명령
다음 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:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)