304 Not Modified
Date:Tue, 28 Jun 2011 10:08:05 GMT
Expires:Fri, 25 Jun 2021 10:08:05 GMT
Last-Modified:Thu, 04 Nov 2010 05:17:08 GMT
在response.setStatus(304);之后,在IE,Firefox上正常,在Chrome中,请求返回状态码还是200,根据日志已经是走的缓存.
几经查询,才发现,
response.addHeader("Expires:","Fri, 25 Jun 2021 10:08:05 GMT");
是标准的格林时间"EEE, dd MMM yyyy HH:mm:ss z";
如下:
Calendar c = Calendar.getInstance(new SimpleTimeZone(0, "GMT"));
SimpleDateFormat s = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z",Locale.US);
s.setTimeZone(TimeZone.getTimeZone("zh_CN"));
System.out.println(s.format(c.getTime()));
Tue, 28 Jun 2011 10:05:06 GMT