RE: wrong name filname generated from serveResource

2640147, modified 16 Years ago. Regular Member Posts: 165 Join Date: 3/27/09 Recent Posts
Hi
I developed portlet which generate file. But everything works ok in ie and opera (I get filname "all.pdf")
But on firefox filename looks like this "all.pdf," (with extra comma)

Why firefox add to filname extra ","?

I have in my configuration.jsp this code :


 <%
 LiferayPortletURL resourceURL = (LiferayPortletURL) renderResponse.createResourceURL();
 resourceURL.setPortletId(ParamUtil.getString(request, "portletResource"));
 resourceURL.setParameter("pdf_one", "true");
  
 %>

<a href="<%= resourceURL.toString()%>" alt="Save to xls"></a>
    <input type="button" value="PDF" name="save_to_xls">



And this in my class

in serveResource I have

  res.setCharacterEncoding("UTF-8");
                res.setContentType("application/pdf");
                res.addProperty(HttpHeaders.CACHE_CONTROL, "max-age=3600, must-revalidate");

                res.addProperty(HttpHeaders.CONTENT_DISPOSITION,"attachment, filename=all.pdf");



Thanks for help

Regards

Dariusz
thumbnail
1395288, modified 16 Years ago. Liferay Legend Posts: 2047 Join Date: 10/7/08 Recent Posts
Hi Dariusz,

Not sure if this is the cause, but content disposition should be separated by semi-colon, not comma:

attachment; filename=all.pdf


http://www.ietf.org/rfc/rfc2183.txt
2640147, modified 16 Years ago. Regular Member Posts: 165 Join Date: 3/27/09 Recent Posts
Thanks for replay.
I made misteke (The post before I pasted code from my tests )

Exactly I have :

attachment; filename=all.pdf


But it's wrong only in Firefox.

Regards

Dariusz