File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Portals and Portlets and the fly likes How to setContentLength in Portlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Portals and Portlets
Reply Bookmark "How to setContentLength in Portlet?" Watch "How to setContentLength in Portlet?" New topic
Author

How to setContentLength in Portlet?

Jane Foster
Greenhorn

Joined: Jun 16, 2009
Posts: 13
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?
 
 
subject: How to setContentLength in Portlet?
 
MyEclipse, The Clear Choice