我们使用 jetty 作为前端 http 服务器,并具有缓存策略。我想明确一下要求:
- 下面的引用是必需的吗?
- 我应该如何在 Java 中实现这个?
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html说:
HTTP/1.1 requires origin servers to send a Date header, if possible, with every response, giving the time at which the response was generated (see section 14.18). We use the term "date_value" to denote the value of the Date header, in a form appropriate for arithmetic operations.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18 :
The Date general-header field represents the date and time at which the message was originated, having the same semantics as orig-date in RFC 822. The field value is an HTTP-date, as described in section 3.3.1; it MUST be sent in RFC 1123 [8]-date format.
jetty 是否包含对日期字段的内置支持,还是我应该自己添加它?有什么有效的方法来生成这个字段吗?
谢谢,
马克西姆。
最佳答案
org.eclipse.jetty.server.Server
类有一个 boolean 值 sendDateHeader
实现这一点的属性。它确实应该默认完成,但事实并非如此。
您可以通过编程方式进行设置,也可以使用 <Set>
jetty.xml
中的元素
关于java - 使用 Jetty 的 RFC 1123 日期表示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4983445/