CSS MIME type: Is it Tomcat or Mozilla?

  • Thread starter Christopher M. Balz
  • Start date
C

Christopher M. Balz

I set the MIME type of a css file that I serve out of the right Tomcat
3.3.1 webapp directory
(http://mydomain.com:8080/mywebapp/static/canvas.css), but Mozilla 1.4
reports that the MIME type is text/plain, not text/css, and so refuses
to load it.

Not surprisingly, Internet Explorer 5.5 has no problem loading the css
file and using it correctly, with or without my web.xml mime-type
mappings. How do I know that Tomcat is sending the css file out as
text/css or not? If it's not, why not? Below please find the web.xml
fragment containing my mime-mapping tags:

<servlet-mapping>
<servlet-name>
PhraseologicSimpleQuery
</servlet-name>
<url-pattern>
/simpleQ
</url-pattern>
</servlet-mapping>

<mime-mapping>
<extension>
css
</extension>
<mime-type>
text/css
</mime-type>
</mime-mapping>


<mime-mapping>
<extension>
html
</extension>
<mime-type>
text/html
</mime-type>
</mime-mapping>

<mime-mapping>
<extension>
js
</extension>
<mime-type>
text/javascript
</mime-type>
</mime-mapping>

</web-app>
 
C

Christopher M. Balz

I found that the text-based Lynx browser has a convenient flag for
checking the MIME type as set by the server. Here is the result of
running that on my short CSS file that is in question here:

- - - - - - - - - - - -

~/lynx http://treelogic-swe.com:8080/phraseologic/static/canvas.css
-head -dump
HTTP/1.0 200 OK
Content-Type: text/css
Content-Length: 174
Last-Modified: Thu, 11 Sep 2003 07:12:33 GMT
Date: Thu, 11 Sep 2003 16:18:46 GMT
Server: Tomcat Web Server/3.3.1 Final ( JSP 1.1; Servlet 2.2 )

BODY {
background-image:
url(http://treelogic-swe.com:8080/phraseologic/static/bac
kground_tile_beige_small.jpg);
margin-left: 20px;
}
..PrimitiveRefresh {
}

TLSWE-LAPTOP-A0 Thu Sep 11 09:08:24
~/

- - - - - - - - -

So, indeed, Mozilla 1.4 is wrongly rejecting a CSS file. (The
situation is a CSS import tag dynamically written to a browser window
frame).

- Chris Balz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top