prabhuish / webutilities

Automatically exported from code.google.com/p/webutilities
0 stars 0 forks source link

When set turnOffETag to true, browser DO NOT USE cache. #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add init-param turnOffETag to true, in web.xml.
    <servlet>
        <servlet-name>JSCSSMergeServlet</servlet-name>
        <servlet-class>com.googlecode.webutilities.servlets.JSCSSMergeServlet</servlet-class>
... blah, blah,
        <init-param>
            <param-name>turnOffETag</param-name>
            <param-value>true</param-value>
        </init-param>

2. Request some js url
http://foo/bar.js

3. Request again
http://foo/bar.js

What is the expected output? What do you see instead?
I expected 304(Not modified) header response. But, status 200 and whole 
resource.

What version of the product are you using? On what operating system?
webutilities-0.0.6.jar
Linux CentOS 5.3
jdk 1.6

Please provide any additional information below.

I guess, header named "Last-Modified" in request does not contain milliseconds, 
but java.io.File.lastModified() returns time containing milliseconds.

in header "Last-Modified" : Sun, 16 Dec 2012 04:02:05 GMT
in file/server os "last modified: Sun, 16 Dec 2012 04:02:05.555 GMT

below source code always false.
    private ResourceStatus isNotModified(HttpServletRequest request, HttpServletResponse response, List<String> resourcesToMerge) {

...blah blah
                if (!isAnyResourceModifiedSince(resourcesToMerge, date.getTime(), context)) { // always false

      if (lastModified > sinceTime) {
(Sun, 16 Dec 2012 04:02:05.555 GMT > Sun, 16 Dec 2012 04:02:05 GMT) // true

Original issue reported on code.google.com by gpard...@gmail.com on 16 Nov 2012 at 5:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
https://github.com/rpatil26/webutilities/commit/ee88063ff3f59cb8722f1b46697761a8
3abe9a7c

Original comment by rr.patil...@gmail.com on 22 Feb 2013 at 8:53