Main Content

matlab.net.http.field.ContentTypeField 클래스

네임스페이스: matlab.net.http.field
슈퍼클래스: matlab.net.http.HeaderField, matlab.net.http.field.MediaRangeField

HTTP의 Content-Type 헤더 필드

설명

ContentTypeField 객체는 요청 메시지나 응답 메시지에 포함되는 HTTP 헤더 필드입니다. 이 필드는 메시지 본문의 콘텐츠 유형을 나타내는 단일 미디어 형식 사양을 포함합니다. 자세한 내용은 RFC 7231 Semantics and Content, section 3.1.1.5. Content-Type(Internet Engineering Task Force 웹사이트)을 참조하십시오.

요청 메시지의 Content-Type 필드는 MessageBody.Data 속성에 지정된 데이터가 변환되는 방식을 결정합니다. 이 변환에 대한 자세한 내용은 HTTP Data Type Conversion 항목을 참조하십시오. 요청 메시지에 본문이 비어 있지 않은 채 포함되어 있으나 Content-Type 필드는 없는 경우, MATLAB®이 데이터형을 기반으로 하여 Content-Type 필드를 생성합니다.

클래스 특성

Sealed
true

클래스 특성에 대한 자세한 내용은 클래스 특성 항목을 참조하십시오.

생성

설명

예제

obj = matlab.net.http.field.ContentTypeField(value)Value 속성을 value로 설정하여 Content-Type 헤더 필드를 생성합니다.

속성

모두 확장

헤더 필드 이름으로, 'Content-Type'으로 지정됩니다.

특성:

GetAccess
public
SetAccess
public
Dependent
true

미디어 형식으로, matlab.net.http.MediaType 객체로 지정되거나 MediaType 생성자가 허용하는 문자열로 지정됩니다. Value는 품질('q') 파라미터를 포함할 수 없습니다.

예: 'text/html;charset=utf-8'

특성:

GetAccess
public
SetAccess
public

메서드

모두 확장

예제

모두 축소

이 예제에서는 메시지의 Content-Type 필드를 읽는 방법을 보여줍니다.

import matlab.net.*;
import matlab.net.http.*;

httpsUrl = 'https://requestserver.mathworks.com';
uri = URI(strcat(httpsUrl, '/assets/computerVision.jpg'));
req = RequestMessage('GET');
response = req.send(uri);
contentTypeField = response.getFields("Content-Type");
disp(contentTypeField)
  ContentTypeField with properties:

     Name: "Content-Type"
    Value: "image/jpeg"

버전 내역

R2016b에 개발됨