The BitSmith created FOP-2342:

             Summary: Make image from URL abide no-cache HTTP headers
                 Key: FOP-2342
             Project: Fop
          Issue Type: Improvement
          Components: images
    Affects Versions: 1.1
         Environment: Tested on CentOS, Tomcat6 and FOP 1.1rc1 service
            Reporter: The BitSmith
            Priority: Minor

When I include an image, it is cached. So including a dynamic image shows only 
the first version of the image. To prevent this, I have to add a constantly 
changing parameter (called "nonce" here):

 <fo:external-graphic width="140mm" height="30mm" 
content-width="scale-down-to-fit" content-height="scale-down-to-fit" 
inline-progression-dimension.maximum="100%" scaling="uniform" 
<xsl:variable name="orgguid" select="Organization/ID" />
<xsl:variable name="nonce" select="Nonce" />
<xsl:variable name="logo" 
select="concat('http://localhost/images/fopimages/logo.php?orgid=', $orgguid, 
'&amp;dummy=', $nonce)"/>
<xsl:attribute name="src">url(<xsl:value-of select="$logo"/>)</xsl:attribute>

This happens despite the fact that the PHP script that produces the image sends 
"no-cache" headers (PHP code):

header('Expires: Fri, 13 May 1983 18:30:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache'); // HTTP/1.0
header('Content-Type: ' . $this->mstrLogoType);
header('Content-Length: ' . strlen($this->mmixLogoData));
header('Content-Disposition: inline');
header('X-Content-Type-Options: nosniff'); // Workaround for IE bug.
echo $this->mmixLogoData;

It would be nice if the image caching mechanism would abide these headers, so 
workarounds like extra parameters are not necessary.

This message was sent by Atlassian JIRA

Reply via email to