• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to setContentLength in Portlet?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic