Tomcat is giving the wrong MIME type?  
Author Message
lvterry





PostPosted: 2006-3-21 4:13:00 Top

java-programmer, Tomcat is giving the wrong MIME type? I use Tomcat serves a web application. I put all the files including
jsp, css and javascript file inside the Tomcat server.
When I request a jsp page through both Firefox1.5 and IE6, I found the
css and the javascript files are not loaded correctly.
I used LiveHttpHeaders to inspect the request and response headers. I
found that the server is giving text/html to the Content-Type of all
the files.
Is the problem in Tomcat configuration or in the browser?
Any idea?
TIA...

 
Juha Laiho





PostPosted: 2006-3-21 4:36:00 Top

java-programmer >> Tomcat is giving the wrong MIME type? email***@***.com said:
>I use Tomcat serves a web application. I put all the files including
>jsp, css and javascript file inside the Tomcat server.
>When I request a jsp page through both Firefox1.5 and IE6, I found the
>css and the javascript files are not loaded correctly.
>I used LiveHttpHeaders to inspect the request and response headers. I
>found that the server is giving text/html to the Content-Type of all
>the files.
>Is the problem in Tomcat configuration or in the browser?

Looks like your version (or installation) of Tomcat doesn't have the
configurations for .js and .css file types. You can add them to
the WEB-INF/web.xml file (see the Servlet Specification for details;
mime-mapping is the element you're looking for).
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)