cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (COCOON-1266) [PATCH] Resource reader fails to add HTTP headers
Date Mon, 29 May 2006 15:38:30 GMT
     [ http://issues.apache.org/jira/browse/COCOON-1266?page=all ]

Antonio Gallardo reassigned COCOON-1266:
----------------------------------------

    Assign To: Antonio Gallardo  (was: Cocoon Developers Team)

> [PATCH] Resource reader fails to add HTTP headers
> -------------------------------------------------
>
>          Key: COCOON-1266
>          URL: http://issues.apache.org/jira/browse/COCOON-1266
>      Project: Cocoon
>         Type: Bug

>   Components: - Components: Sitemap
>     Versions: 2.1.5
>  Environment: Operating System: All
> Platform: All
>     Reporter: Martin Kuck
>     Assignee: Antonio Gallardo

>
> The resource reader does not add Last-Modified and Expires headers when serving 
> resources from the cocoon cache. This leads to unneccessary request from 
> clients. I think setting the headers in setup() instead of generate() should 
> fix this problem because generate will only be called for resources not already 
> in the cache.
> Fixing this will trigger another bug introduced with patch #14048. This causes 
> all resources to be deliverd with a Vary:Host header unless an expiration time 
> has been set on the reader (which you usually won´t do). This causes IE to read 
> the resource again and again. The correct solution is to add an Expires header 
> with a value of 0, but only if configured!
> I prepared a small patch (against 2.1.5) to fix both problems:
> diff -u -r1.1.1.3 -r1.5
> --- ResourceReader.java	10 Jun 2004 11:23:49 -0000	1.1.1.3
> +++ ResourceReader.java	10 Jun 2004 12:36:49 -0000	1.5
> @@ -118,6 +118,15 @@
>  
>          try {
>              inputSource = resolver.resolveURI(src);
> +
> +			if (expires >= 0) {
> +				response.setDateHeader("Expires", expires > 0 ? 
> System.currentTimeMillis() + expires : 0);
> +			}
> +            
> +			long lastModified = getLastModified();
> +			if (lastModified > 0) {
> +				response.setDateHeader("Last-Modified", 
> lastModified);
> +			}                        
>          }
>          catch (SourceException se) {
>              throw SourceUtil.handle("Error during resolving of '" + src 
> + "'.", se);
> @@ -255,18 +264,6 @@
>       */
>      public void generate() throws IOException, ProcessingException {
>          try {
> -            if (expires > 0) {
> -                response.setDateHeader("Expires", System.currentTimeMillis() + 
> expires);
> -            }
> -            else {
> -                response.addHeader("Vary", "Host");
> -            }
> -
> -            long lastModified = getLastModified();
> -            if (lastModified > 0) {
> -                response.setDateHeader("Last-Modified", lastModified);
> -            }
> -
>              try {
>                  inputStream = inputSource.getInputStream();
>              }
> @@ -316,3 +313,4 @@
>      }
>  
>  }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message