Main Content

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

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

HTTP의 Cookie 헤더 필드

설명

Set-Cookie 필드에 쿠키가 있으면 요청 메시지에 CookieField 객체를 포함시켜 서버에 쿠키를 전송할 수 있습니다. 자세한 내용은 IETF®(Internet Engineering Task Force) 웹사이트의 RFC 6265 HTTP State Management Mechanism을 참조하십시오.

클래스 특성

Sealed
true

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

생성

설명

예제

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

속성

모두 확장

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

특성:

GetAccess
public
SetAccess
public

쿠키로, 문자열로 지정됩니다.

특성:

GetAccess
public
SetAccess
public
Dependent
true

메서드

모두 확장

예제

모두 축소

이 예제에서는 모든 쿠키를 서버로 전송합니다. 실제로는, 만료되지 않은 쿠키만 전송할 수 있습니다.

초기 교환에 인증과 리디렉션을 위한 여러 메시지가 포함된 경우 이러한 모든 메시지를 포함하는 내역에서 CookieInfo 객체를 가져오려고 할 수 있습니다. 자세한 내용은 CookieInfo.collectFromLog 항목을 참조하십시오.

r = matlab.net.http.RequestMessage;
resp = send(r,'https://www.mathworks.com');
setCookieFields = resp.getFields('Set-Cookie');
if ~isempty(setCookieFields)
   % fetch all CookieInfos from Set-Cookie fields and add to request
   cookieInfos = setCookieFields.convert;
   r = r.addFields(matlab.net.http.field.CookieField([cookieInfos.Cookie]));
end
resp = r.send('https://www.mathworks.com');

버전 내역

R2016b에 개발됨