• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to setContentLength in Portlet?  RSS feed

Jane Foster
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to open a saved pdf file in a portlet. It is working in Firefox but not in Internet Explorer.

The way I am opening the file is I am setting the content type to application/pdf, and then writing the bytes to the PortletOutputStream.
The pdf was generated using iText and after reading the documentation I discovered that IE needs to know the content length in order to open a pdf.

This is easy to do in a servlet, it's just response.setContentLenth(file.length());

However, in a portlet, neither the RenderResponse or PortletResponse allow you to set the content length, only the type.

Does anyone know if there is any way to set the content length of a file in a JSR-168 portlet?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!