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

mime types in J2ee Application  RSS feed

 
ravi v kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

We had fews links which will download/open the files like excel,pdf,dot,doc files. right now whenever we click the link which points to above files, displays the content in binary format instead of downloding or showing it using respective editors.
our application details:
app server : Sun Java Application Server 8.x
app server installed in unix OS
browser : IE 6.X

so do we need to add mime mappings in web.xml so that server will understand?
i am trying to all mapping like below in web.xml, will this fix the problem??

<!-- Set Excel mime-mapping so spreadsheets open properly instead of being sent as an octet/stream -->
<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried it?

I'm surprised that those mappings weren't already there.
 
ravi v kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben,

As of now no mime mappings are there in web.xml
will it be useful/fix the problem??
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know a lot about Sun's application server, but in Tomcat, there is a global web.xml file in the conf directory. If I'm not mistaken, it uses GlassFish for its servlet container and Glassfish is a fork from Tomcat so there is a good chance it's in the same place.

This one has configurations for things like the default servlet (the one that serves up static resources) and has all the pre-configured mime types.
See if you can find where these settings are stored and look for the mime type in question.
[ July 12, 2007: Message edited by: Ben Souther ]
 
ravi v kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,
sorry i am bit away from this topic.
i found the problem which causes this.
thing is we had a Redirector Servlet[like Controller servlet in struts] which is the only entry for accessing our application/pages in which they are placing the response.setContentType("html/text");

so, i found it and fixed it.

thanks again,
for your valueable response!!
ravi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!