This post originated from an RSS feed registered with Java Buzz
by John Topley.
Original Post: JDeveloper, Apache And MIME Types
Feed Title: John Topley's Weblog
Feed URL: http://johntopley.com/posts.atom
Feed Description: John Topley's Weblog - some articles on Ruby on Rails development.
I've just got to the bottom of a fairly obscure problem that occurs when using Mozilla Firefox to access a web application developed using Oracle JDeveloper. The JSPs in my application link to an external stylesheet, but the pages weren't styled when viewed using a Gecko-based browser, such as Firefox. However, they were fine when using Internet Explorer or Opera.
Changing to an inline stylesheet declaration fixed the problem, which suggested that there might have been something about my external stylesheet declaration that Firefox didn't like:
—There's nothing out of the ordinary there. Using the JavaScript Console in Firefox showed that the error was occurring because the CSS file was being served with a MIME type of application/octet-stream instead of text/css:
Click to enlarge.
—This opened up another avenue of investigation. JDeveloper includes a cut-down, embedded version of Oracle's OC4J J2EE application server. This enables J2EE components and web applications to be run from within the IDE. I know that OC4J uses Apache as its web server, which led me to suspect that I was dealing with an Apache configuration problem and not a JDeveloper or OC4J problem. I sniffed around in the configuration directory for the embedded container and found a file named mime.types, which seemed a likely candidate for modification. I added the line:
text/css css
…restarted the application and all was now well. I could admire the results of my beautiful stylesheet in Firefox and marvel at how different it looked from IE.