我有一个“无头”XPage(返回 JSON),并且正在设置 Expires 标头以强制浏览器在至少一个小时内不再请求 JSON 提要。我在 AfterRenderResponse 事件中有如下代码 - 但查看响应标头,我看到了我的 Expires 标头,但还看到了 Domino 似乎强制的附加“Expires:-1”标头。我在 8.5.1 和 8.5.3 服务器上看到了这一点。这是已知的错误吗?有什么方法可以阻止 Domino 添加 expires 标头?
// Get handle to output writer - we will sender JSON text directly
var externalContext = facesContext.getExternalContext();
var writer = facesContext.getResponseWriter();
var response = externalContext.getResponse();
// set headers
response.setContentType("application/json");
var now = new Date();
response.setDateHeader ("Expires", now.getTime() + (60*60*1000));
response.setHeader("Cache-Control", "public");
// Output it
writer.write(getJSONResponse ());
writer.endDocument();
facesContext.responseComplete();
我在回复中看到的是:
HTTP/1.1 200 OK
Server: Lotus-Domino
Date: Tue, 15 May 2012 13:17:57 GMT
**Expires: -1 <--- WHY????**
Content-Type: application/json;charset=UTF-8
Expires: Tue, 15 May 2012 14:17:52 GMT
Cache-Control: public
Content-Length: 901