matlab.net.http.field.HTTPDateField 类
命名空间: matlab.net.http.field
超类: matlab.net.http.HeaderField
包含日期的 HTTP 标头字段
描述
HTTPDateField
对象是包含日期的 HTTP 标头字段。通过此类实现的字段包含一个标准 HTTP 日期格式的日期。
创建对象
属性
Name
— 日期字段名称
'Date'
| 'Expires'
| 'Retry-After'
| 'Accept-Datetime'
| 'Last-Modified'
| 'If-Modified-Since'
日期字段名称,指定为字符串,可以为下列值之一:'Date'
、'Expires'
、'Retry-After'
、'Accept-Datetime'
、'Last-Modified'
或 'If-Modified-Since'
。
要创建 Date
字段,请使用 matlab.net.http.field.DateField
子类。
属性:
GetAccess | public |
SetAccess | public |
Value
— 日期
datetime
| 字符串
日期,指定为 datetime
对象或采用有效 HTTP 日期格式的字符串,如 Internet Engineering Task Force (IETF®) 网站上的 RFC 7231 Semantics and Content, section 7.1.1.1.Date/Time Formats。如果 datetime
对象没有时区,则假定为本地时区。
属性:
GetAccess | public |
SetAccess | public |
Dependent | true |
方法
公共方法
addFields | 向 HeaderField 数组中添加字段 |
removeFields | 从标头字段数组中删除字段 |
changeFields | 更改 HeaderField 数组中的现有值 |
replaceFields | 更改 HeaderField 数组中的值或向其中添加字段 |
getFields | 返回与名称或类匹配的标头字段 |
eq | 比较两个 HeaderField 数组 |
convertLike | 以与另一个标头字段类似的转换方式来转换标头字段的值 |
parse | 解析标头字段值并返回为字符串 |
displaySubclasses | 显示支持的 HeaderField 子类 |
专用于子类
专用运算符和函数
这些方法将标准的 MATLAB 运算符和函数应用于此类中的对象。
isequal | 如果两个标头字段数组大小相同且对应元素相等,则为 |
string | 以字符串形式返回标头字段数组,如其在消息中所示。字段之间会插入换行符,但并非所有字段末尾都会有换行符。 |
char | 以字符向量形式返回标头字段数组,如 |
示例
显示 HTTP 日期字段
此示例说明如何读取消息中的 HTTP 日期字段。
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); response = req.send(uri); httpDateField = response.getFields("Last-Modified"); disp(httpDateField)
HTTPDateField with properties: Name: "Last-Modified" Value: "Fri, 02 Apr 2021 20:14:03 GMT"
版本历史记录
在 R2016b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 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)