gvijay1
asked on
Java Servlet to stream in Word document into browser
Experts,
I am using a Servlet to read a MS Word document from a remote server and display it to the user within the IE browser. My servlet looks like this:
The document is located in: http://server/Document.doc
1. res.setContentType( "application/msword" );
2. Open URL connection to the above document.
3. Read the contents and write.
When I access the servlet, I am getting an annoying pop-up asking me to Open or Save the contents. WHen I click Open, the correct file is opened (so, it is accessing the document correctly). How can I automatically open the contents in a browser window instead of prompting the user with that Download pop-up?
Thanks
I am using a Servlet to read a MS Word document from a remote server and display it to the user within the IE browser. My servlet looks like this:
The document is located in: http://server/Document.doc
1. res.setContentType( "application/msword" );
2. Open URL connection to the above document.
3. Read the contents and write.
When I access the servlet, I am getting an annoying pop-up asking me to Open or Save the contents. WHen I click Open, the correct file is opened (so, it is accessing the document correctly). How can I automatically open the contents in a browser window instead of prompting the user with that Download pop-up?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Of course this is true only if the document is opened using the microsoft word in external window
(not inside the browser).
(not inside the browser).
ASKER
I tried using the Content-Disposition field as well as described above, but it does not work either. The download box still opens asking for user input. When I click OK to open, the document is not opened within a browser window but instead in MS Word itself.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
res.addHeader("Content-Dis