java - 使用 Jetty 的 RFC 1123 日期表示

标签 java jetty browser-cache rfc1123

我们使用 jetty 作为前端 http 服务器,并具有缓存策略。我想明确一下要求:

  1. 下面的引用是必需的吗?
  2. 我应该如何在 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/

相关文章:

tomcat - Tomcat 和 Jetty 哪一个更适合 Vaadin 应用程序?

java - Jetty.util.MultiMap 抛出 ConcurrentModificationException

java - 错误的 java.net.BindException : Address already in use on Jetty

php - 动态缩小 CSS : leveraging browser caching

java - 如何以编程方式读取方法返回类型上定义的注释

从数组访问方法时出现 java.lang.NullPointerException 错误

java - 使用可扩展字符串设置两个第一个单词的样式

java - 如何搜索和过滤 fragment 中的文本

internet-explorer - 防止在 Internet Explorer 8 中缓存页面

ssl - 浏览器多久会自动重置 SSL 缓存?