tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34118] New: - Last-Modified Header unpredictable when using includes
Date Tue, 22 Mar 2005 05:00:24 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34118>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34118

           Summary: Last-Modified Header unpredictable when using includes
           Product: Tomcat 5
           Version: 5.5.7
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: colinlear@gmail.com


When you include static content with <jsp:include> or similar (without 
flush="true") the DefaultServlet implementation calls setHeader for the Last- 
Modified header. This is passed to the response for the overall request and 
overwrites any previously set value.

This means that the Last-Modified header varies depending on the last include. 
Admittedly the size of the response may mean that flush() was called prior to 
the include, complicating the issue further.

The problem cropped up with a dynamic page that handles a login for users. If 
you are already logged in it includes a different page to that of a public user. 
This meant that the Last-Modified date was being overwritten depending on when 
the various included content pages were modified. It was very difficult to 
isolate the cause of the problem as it very inconsistent from page to page.

The problem manifested itself irregularly and only with certain browsers/proxies 
caching the content. Only some setups seem to observe the Last-Modified Date 
over other headers that were set to discourage caching. This in turn lead to 
problems logging in or out of the site for certain users. (Generally a browser 
refresh fixed the problem)

It seems appropriate that the Last-Modified header should either not be set at 
all by included content, or at least not to a value prior to any current value. 
The latter option would be the most correct. However it probably should not 
preclude overwriding the modified date with a smaller value if that was what you 
wanted.

A workaround is not to include static content (only dynamic content). You can 
also call response.flush() to send the headers prior to the include.

Sorry that there is no example URL. It's pretty easy to replicate. Set the last 
modified timestamp of a non-jsp file (using touch -B for example) and include 
into a small page with <jsp:include page="..." flush="false"/>

A simple examination of the response headers should reveal that the Last-
Modified date is the date of the included file not the JSP.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message