Main Content

이 번역 페이지는 최신 내용을 담고 있지 않습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.

removeFields

클래스: matlab.net.http.Message
네임스페이스: matlab.net.http

메시지 헤더에서 필드 제거

설명

예제

msg = removeFields(msg,ids)ids와 일치하는 모든 헤더 필드를 제거하고 업데이트된 메시지를 반환합니다.

입력 인수

모두 확장

메시지로, matlab.net.http.Message 객체로 지정됩니다.

일치시킬 이름으로, 다음 중 하나로 지정됩니다.

  • 제거할 필드의 이름을 포함하는 string형 벡터, 문자형 벡터, 문자형 벡터로 구성된 셀형 배열, string형 또는 문자형 벡터로 구성된 쉼표로 구분된 목록 중 하나. 이름은 대/소문자를 구분하지 않습니다.

  • 하나 이상의 HeaderField 객체로 구성된 쉼표로 구분된 목록이나 벡터. 제거할 필드는 이러한 객체의 Name 속성을 사용하여 결정됩니다. 이름은 대/소문자를 구분하지 않습니다. 헤더 필드 값은 무시됩니다.

  • HeaderField의 서브클래스인 meta.class 객체로 구성된, 쉼표로 구분된 목록이나 벡터.

    removeFields 메서드는 지정된 클래스에 상관없이 이러한 클래스가 지원하는 이름과 일치하는 이름을 검색합니다. 서브클래스에 지원되는 특정 이름 집합이 없을 경우 해당 서브클래스의 모든 헤더 필드가 이름에 상관없이 일치됩니다. 지원되는 이름을 보려면 HeaderField.displaySubclasses 메서드를 호출하십시오.

예: getFields(response,'Date','Content-Type')

예제

모두 확장

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 클래스는 두 개의 서브클래스 AcceptFieldContentTypeField를 가집니다. 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에 개발됨