• 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 Access Multiple Servlet Instances

 
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my app a user requests Engineering Drawing data. A servlet presents a page with the data including a http link to the drawing file so it can be viewed. I use a servlet to display the drawing to the user. The problem is the user may need more than one drawing at a time open. The only way I have found to get this to work is using the following line of code in the servlet:

arg1.setHeader("Content-Disposition", "attachment");

However, this causes the user to be prompted as wheather to Open, Save or Cancel. If I take this line out the drawing is presented in a page that is overwritten with each response(only one at a time).

How can I get the prompt to not display and the default always be Open?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't. If you dispose the response as an attachment, it directs the browser to download the file; hence the Save As dialog. You cannot write files to the user's system directly without them knowing about it. Imagine the security implications if this were possible!

If you want multiple windows to open, you'll need to open them using client-side code, and submit a request for each drawing in each window.
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,

After looking at it a little closer having the user deal with the dialog box seems the best way.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic