@HttpCache(allow=true) not setting Cache-control, Pragma
--------------------------------------------------------

                 Key: STS-630
                 URL: http://www.stripesframework.org/jira/browse/STS-630
             Project: Stripes
          Issue Type: Bug
          Components: ActionBean Dispatching
    Affects Versions: Release 1.5
         Environment: Win64, Tomcat 6, IE/FF
            Reporter: Matt Brock
            Priority: Minor


The @HttpCache annotation isn't setting either the "Cache-control" or "Pragma" 
headers.  In IE over SSL, this can potentially break file downloading for 
StreamingResolutions.  In the following example, the action is annotated to 
prevent caching, but the inner method overrides this to allow it.

---
@HttpCache(allow=false)
public class MyUncachedAction implements ActionBean {

  @DefaultHandler
  public Resolution view() {
    return new ForwardResolution("test.jsp");
  }

  @HttpCache(allow=true)
  public Resolution download() {
    return new StreamingResolution("application/vnd.mx-excel") {
      public void stream(HttpServletResponse response) throws Exception {
        // output response, e.g.:
        // response.getOutputStream().write(...);
        // response.getOutputStream().flush();
      }
    }.setFilename("test.csv");
  }

}
---

The expiration header is properly set (line 87, 
net.sourceforge.stripes.controller.HttpCacheInterceptor), but the Cache-control 
and Pragma settings are left untouched, so you end up with a mix of directives 
that, under *most* circumstances, will simply expire the page, but in IE 
(because of the existence of the Cache-control/Pragma header) will keep the 
no-cache setting, causing the download to fail.

The fix I've been using is to add empty values to the appropriate headers.  
E.g.-

response.setHeader("Cache-control", "");
response.setHeader("Pragma", "");

More information on this can be found from Microsoft: 
http://support.microsoft.com/kb/323308

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

        

------------------------------------------------------------------------------
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to