?
Solved

Java Servlet to stream in Word document into browser

Posted on 2006-07-19
10
Medium Priority
?
1,643 Views
Last Modified: 2013-11-24
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
0
Comment
Question by:gvijay1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 100 total points
ID: 17143687
You should add "Content-Disposition" header also:

http://support.microsoft.com/kb/260519/EN-US/
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17143704
Like

res.addHeader("Content-Disposition", "inline; filename=Document.doc");

0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 100 total points
ID: 17144244
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Assisted Solution

by:firas981
firas981 earned 100 total points
ID: 17170798
Your browser must has a plugin that is capable of reading the file! Browsers usually display the download box when they don't know how to open them.
0
 

Expert Comment

by:firas981
ID: 17170823
Of course this is true only if the document is opened using the microsoft word in external window
(not inside the browser).
0
 

Author Comment

by:gvijay1
ID: 17175361
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.
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 100 total points
ID: 17175432
Then perhaps IE is not configured to open Word files at all (no plug-in or plug-in disabled)
0
 

Expert Comment

by:firas981
ID: 17184302
JC_ActiveDoc
http://www.jcsoft.com/docobject/

It is for netscape, but it worked for me with IE 6.0

0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
A solution for Fortify Path Manipulation.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question