Main Content

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

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

HTTP의 Date 헤더 필드

설명

DateField 객체는 HTTP의 Date 헤더 필드를 나타냅니다. Date 필드는 요청 메시지나 응답 메시지가 원래 전송된 날짜와 시간을 나타내는 선택적 필드입니다. 요청 메시지에 Date 필드를 지정하지 않으면 메시지를 전송할 때 MATLAB®이 이 필드 값을 삽입합니다. 이 필드에 대한 자세한 내용은 IETF®(Internet Engineering Task Force) 웹사이트의 RFC 7231 Semantics and Content, section 7.1.1.2 Date를 참조하십시오.

클래스 특성

Sealed
true

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

생성

설명

예제

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

obj = matlab.net.http.field.DateField는 현재 날짜와 시간으로 필드 값을 설정합니다.

속성

모두 확장

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

특성:

GetAccess
public
SetAccess
public

날짜와 시간으로, datetime 객체로 지정되거나 유효한 HTTP 날짜 형식의 문자열로 지정됩니다. 디폴트 값은 현재 날짜와 시간입니다. Value는 미래의 날짜일 수 없습니다. 표준 시간대가 누락된 경우 현지 표준 시간대가 사용됩니다. datetimeFormat 속성은 무시됩니다.

특성:

GetAccess
public
SetAccess
public
Dependent
true

메서드

모두 확장

예제

모두 축소

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

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

httpsUrl = 'https://requestserver.mathworks.com';
uri = URI(strcat(httpsUrl, '/assets/computerVision.jpg'));
headers = DateField(datetime("today"));
req = RequestMessage('GET', headers);
[~, completedRequest, ~] = req.send(uri);
dateField = completedRequest.getFields("Date");
disp(dateField)
  DateField with properties:

     Name: "Date"
    Value: "Wed, 28 Apr 2021 04:00:00 GMT"

버전 내역

R2016b에 개발됨

참고 항목