The most intelligent Java IDE
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Portals and Portlets
 
RSS feed
 
New topic
Author

How to setContentLength in Portlet?

Jane Foster
Greenhorn

Joined: Jun 16, 2009
Messages: 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?
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Portals and Portlets
 
RSS feed
 
New topic
replay challenge

.