Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Opening word document in browser  RSS feed

 
Ketan Mohite
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a web application which uses Webshere as a web server.I do development and testing on Test Server.

I have a piece of code in which,I open a document which is opened in its default format in a browser.For e.g. I have a word file on a server side, which is supposed to be opened in client's browser in word format,when he/she access it.

The document opens in a proper format in browser with Live Server but not the same case with the Test Server.On Test Server the file is opened in browser but it is not in proper word format.

Please dont give any code suggestions for this as the same code runs on both Server there is nothing wrong with the code.

Is there any server configuration involvement in this?

Please let me know soon.
Its urgent


Thanks & Regards,
Ketan
 
Ketan Mohite
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After seaching through websphere's internal directory structure, I found that there is somehting called as content-types.properties in Websphere/java/jre/lib directory.This file has information about various MIME types.
---------------------------------------------
e.g.
application/pdf:
\description=Adobe PDF Format;\
file_extensions=.pdf
----------------------------------------

I added :
-------------------------------------
application/msword: \
description=Microsoft Word Format;
file_extensions=.doc
-----------------------------------------
these lines to it.

But it didnt help.

Note that PDF File opens fine , even though I remove the above lines in content-type.properties file.

Now can you please suggest me whether content-type.properties is right file for the configuring the MIME type or any other location.

Thanks & Regards,
Ketan
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the content type on the returned page to application/msword and
simply output the contents of the msword document and nothing else.

This is of course, assuming that the browsers used can handle an msword
document. If you need to recreate the contents of the document in html,
then have fun. It won't be either quick or easy.
[ March 29, 2006: Message edited by: Martin Simons ]
 
Arun Boraiah
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
try this one out.

in the application web.xml check if the mime type is mapped. If not add
following code

<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>

restart the server after the changes and you should be able to achive what you intent.
find the other Ms-office mime mapping for your reference.
<mime-mapping> <extension>xls</extension> <mime-type>application/vnd.ms-excel</mime-type> <extension>mdb</extension> <mime-type>application/vnd.ms-access</mime-type> <extension>mpp</extension> <mime-type>application/vnd.ms-project</mime-type> <extension>doc</extension> <mime-type>application/msword</mime-type> <extension>xls</extension> <mime-type>application/ms-excel</mime-type> <extension>ppt</extension> <mime-type>application/ms-powerpoint</mime-type></mime-mapping>


Regards
Arun
[ March 29, 2006: Message edited by: Arun Boraiah ]
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you are missing a slash after Microsoft Word Format;
 
Ketan Mohite
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Friends,
Thanks for the reply....
I have already mentioned not to give me any code suggestions...so setting content type should not work for me....

About setting MIME type...I am using websphere, which doesnt have MIME configured in web.xml.
I added in my reply that I got something called as content-type.properties, which has all these information.But as I also mentioned there that even making changes there also doesnt reflect positive result.

Thanks for the latest reply that was recieved,I will try that tommorrow since I have off today and if it works then fine.

I think better to move this topic to Websphere forum because it seems more like websphere issue.

Thanks & Regards
Ketan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!