• 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

Help with opening a pdf in web browser

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if this is where my question belongs but i'll give it a shot.

I need to display a pdf stored in a byte array in a web browser so this is what i've done so far. First i have a jsp that when submited executes the following:

Where 'OpenPDF' maps to my servlet. The problem is with the following code in the servlet:

The problem is that throws an IllegalStateExeption saying that 'OutPutStream already obtained' since the response being passed in is the response object from the jsp and it has that darn 'out' object.

What can I do about this so that I will be able to display the pdf??? Ideally in a separate window aswell.

Thanks
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to stream binary content, don't involve JSPs. That's causing the problem here. Craft the page flow so that the download request goes directly to the servlet that streams it. Then you should not have any problems.
reply
    Bookmark Topic Watch Topic
  • New Topic