[
http://www.stripesframework.org/jira/browse/STS-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11582#action_11582
]
Ben Gunter commented on STS-630:
--------------------------------
Matt, I'm not seeing the behavior you describe. My understanding is that you're
saying even with @HttpCache(allow=true) on your "download" event handler you're
getting the Expires, Pragma, and Cache-control headers set. If I misunderstand,
then please clarify exactly what headers you are seeing for both the view and
download events. However, if I do understand you correctly ...
I just set up the following class to test this:
@UrlBinding("/test/3/{$event}")
@HttpCache(allow = false)
public class OnBoth extends BaseActionBean {
@DefaultHandler
public Resolution view() {
String href = getContext().getRequest().getContextPath()
+ new UrlBuilder(getContext().getRequest().getLocale(),
getClass(), true).setEvent(
"download").toString();
return new StreamingResolution("text/html", new StringReader("<a
href=\"" + href
+ "\">Download</a>"));
}
@HttpCache(allow = true)
public Resolution download() {
return new StreamingResolution("text/plain", new StringReader("OK\n"))
.setFilename("test.txt");
}
}
For the view event, I get the following:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Type: text/html;charset=ISO-8859-1
Content-Language: en-US
Content-Length: 52
Date: Tue, 23 Dec 2008 14:38:33 GMT
Connection: close
<a href="/stripes-test/test/3/download">Download</a>
For the download event, I get the following:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: attachment; filename="test.txt"
Content-Type: text/plain;charset=ISO-8859-1
Content-Language: en-US
Content-Length: 3
Date: Tue, 23 Dec 2008 14:39:25 GMT
Connection: close
OK
Those look right to me. Are you getting different results?
> @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
> Assignee: Ben Gunter
> Priority: Minor
> Fix For: Release 1.5.1, Release 1.6
>
>
> 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