[seam-issues] [JBoss JIRA] (JBSEAM-4853) Change DocumentStorePhaseListener to allow downloads of IE over SSL
Alberto Fernández (Created) (JIRA)
jira-events at lists.jboss.org
Wed Nov 2 07:10:46 EDT 2011
Change DocumentStorePhaseListener to allow downloads of IE over SSL
-------------------------------------------------------------------
Key: JBSEAM-4853
URL: https://issues.jboss.org/browse/JBSEAM-4853
Project: Seam 2
Issue Type: Enhancement
Components: Core
Affects Versions: 2.2.2.Final
Reporter: Alberto Fernández
If you try to download a file (tried with excel files) over ssl with IE , it fails.
Changing the DocumentStorePhaseListener and changing the headers 'Cache-Control' and 'Pragma' makes it work.
public void sendContent(FacesContext context, String contentId) {
try {
DocumentData documentData = DocumentStore.instance().getDocumentData(contentId);
if (documentData != null) {
HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
boolean isIE = false;
if( request != null) {
String useragent = request.getHeader("User-Agent");
isIE = (useragent != null && useragent.indexOf("MSIE") >= 0);
}
response.setContentType(documentData.getDocumentType().getMimeType());
response.setHeader("Content-Disposition", documentData.getDisposition() + "; filename=\"" + documentData.getFileName() + "\"");
if (isIE) {
response.setHeader("Cache-control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", null);
}
documentData.writeDataToStream(response.getOutputStream());
context.responseComplete();
}
} catch (IOException e) {
log.warn(e);
}
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list