You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by mkgolfer <mk...@yahoo.com> on 2011/07/11 19:30:19 UTC
Excel Exports using Weblogic HTTPS issues
Hi All,
I am using the Apache POI Excel Export...works great in a non-secure
environment with IE8 and works great in a secured environment with FireFox.
However, when running in a secure environment with IE 7 or 8 and the Excel
export attempts to open, I get this error msg from IE...
http://click.1134972.n2.nabble.com/file/n6571834/ieerror.jpg
Here a snippet of code that I am using:
HttpServletResponse response = getContext().getResponse();
HSSFWorkbook wb = createWorkbook();
// Set response headers
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");
response.setHeader("Content-Disposition",
"attachment;filename=\"expectedPayback.csv\"");
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
wb.write(baos);
//String contentType = ClickUtils.getMimeType(".xls");
String contentType = ClickUtils.getMimeType("application/x-download");
ActionResult actionResult = new ActionResult(baos.toByteArray(),
contentType);
//return actionResult;
return null;
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
Any ideas?
Thanks
Mark K.
--
View this message in context: http://click.1134972.n2.nabble.com/Excel-Exports-using-Weblogic-HTTPS-issues-tp6571834p6571834.html
Sent from the click-user mailing list archive at Nabble.com.
Re: Excel Exports using Weblogic HTTPS issues
Posted by mkgolfer <mk...@yahoo.com>.
Hi Bob,
well, using the POI I could not get it to work. So what I did was created a
Click Page servlet, redirected the request to that servlet and within the
servlet did this:
setPath(null).
This worked so we are good to go.
Thanks for the suggestions!
Mark K
--
View this message in context: http://click.1134972.n2.nabble.com/Excel-Exports-using-Weblogic-HTTPS-issues-tp6571834p6600735.html
Sent from the click-user mailing list archive at Nabble.com.
Re: Excel Exports using Weblogic HTTPS issues
Posted by Bob Schellink <sa...@gmail.com>.
Hi Mark,
I don't think the issue is Click specific but rather because of IE caching. The way to resolve it is
through the proper HTTP response headers. Have a look at this link:
http://stackoverflow.com/questions/4672073/export-to-excel-doesnt-work-on-ie-under-ssl-https
Play with this header as well: "Cache-Control", "cache, must-revalidate"
In Click the Page has default headers which could influence the result. Here are the default headers
Click adds:
"Pragma", "no-cache"
Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
"Expires", new Date(1L)
You can tune the default headers through the Page.setHeader or click.xml. Alternatively you could
serve the XLS through a custom Servlet instead of a Page and have complete control over the response.
Kind regards
Bob
On 2011/07/11 19:30 PM, mkgolfer wrote:
> Hi All,
> I am using the Apache POI Excel Export...works great in a non-secure
> environment with IE8 and works great in a secured environment with FireFox.
> However, when running in a secure environment with IE 7 or 8 and the Excel
> export attempts to open, I get this error msg from IE...
> http://click.1134972.n2.nabble.com/file/n6571834/ieerror.jpg
>
> Here a snippet of code that I am using:
> HttpServletResponse response = getContext().getResponse();
>
> HSSFWorkbook wb = createWorkbook();
>
> // Set response headers
> response.setHeader("Pragma", "public");
> response.setHeader("Cache-Control", "max-age=0");
> response.setHeader("Content-Disposition",
> "attachment;filename=\"expectedPayback.csv\"");
>
>
> try {
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> wb.write(baos);
>
> //String contentType = ClickUtils.getMimeType(".xls");
> String contentType = ClickUtils.getMimeType("application/x-download");
>
> ActionResult actionResult = new ActionResult(baos.toByteArray(),
> contentType);
>
> //return actionResult;
> return null;
>
> } catch (IOException ioe) {
> throw new RuntimeException(ioe);
> }
> }
> Any ideas?
>
> Thanks
>
> Mark K.
>
> --
> View this message in context: http://click.1134972.n2.nabble.com/Excel-Exports-using-Weblogic-HTTPS-issues-tp6571834p6571834.html
> Sent from the click-user mailing list archive at Nabble.com.
>