如何在 play 2.0 的结果对象中设置 Http 标头?
我想设置缓存控制(过期):
缓存控制
公开,最大年龄=2592000
检查 ET 标签并返回正确响应的最佳方法是什么?
一直在看这里,但没有看到任何东西:http://www.playframework.org/documentation/2.0.1/JavaActions http://www.playframework.org/documentation/2.0.1/JavaActions
提前致谢
托马斯·韦尔维克
您需要查看 JavaResponse 部分...
http://www.playframework.org/documentation/2.0.1/JavaResponse http://www.playframework.org/documentation/2.0.1/JavaResponse
文档中设置缓存控制的示例是
public static Result index() {
response().setContentType("text/html");
response().setHeader(CACHE_CONTROL, "max-age=3600");
response().setHeader(ETAG, "xxx");
return ok("<h1>Hello World!</h1>");
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)