开发者

RFC 1123 date representation with Jetty

We're using jetty as front end http server, with cache policies. I would like to be clear on the requirements:

  1. Is the quoted below requir开发者_JAVA百科ed?
  2. How should I implement this in Java?

http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html says:

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.

Does jetty contains built in support for Date fields or should I be adding this by myself? Any efficient method to generate this field?

Thank you,

Maxim.


The org.eclipse.jetty.server.Server class has a boolean sendDateHeader property that enables this. It really should be done by default, but it isn't.

You can either set that programmatically, or usins a <Set> element in jetty.xml

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜