File Resource Mime-Type Lessons
This was going to be another Domino sucks posts, but has since turned in to praise for Domino.
When I first tried to plug in the IE Behavior I mentioned yesterday it didn't work. After looking for all the obvious mistakes I looked for the less obvious. First off, what mime-type IE expected for the .HTC file. Using HTTPWatch I looked at what mime-type the working MSDN demo page used:
The .htc file was sent as text/x-component. In my Domino database I'd added it as a File Resource and it was sent to IE as application/octet-stream, like below:
This is where I cursed Domino. Why can't I send the file in my own mime-type!? To get the Behavior working I pasted its content in to a Page and set the mime-type in its properties. This post was then going to be a lambasting of Notes and a suggestion that the File Resource object allow you to set the mime-type. Lucky for me I checked whether you can actually do this. You can. I'd just assumed you couldn't. For each File Resource there's the following property:
You can take it one step further and make the server recognise the .htc file extension as a Behaviour and always send it as text/x-component. Open your Domino Directory and find the File Identification view. Add a new document, like below:
So, Domino ain't all bad and I deserve a slapped wrist for continually thinking so little of it. In fact, as it turned out, the problem with the Behavior wasn't even that it had the wrong mime-type. Despite all this I think knowing about mime-types is always good. I guess most of you knew about being able to change mime-types of File Resources?
Browsers based on Mozilla don't like CSS being sent to them with anything other than the text/css mime-type. There are other files like this. XML/XSL is especially funny about it. Worth noting.
> "I guess most of you knew about being able to change mime-types of File Resources?"
Yep!
Useful to know about the File Identification settings, though. Does this update the server's httpd.cnf file?
Know-it-all !
Not sure if it update's it or not Blop. A http restart is needed though, so maybe so.
Excellent! I frequently use the mime-type settings on pages to use them as js or css files, so at least IBM is being consistent on this issue.
Jake, you can still harbour a little hatred if you want. The MIME type setting doesn't stick, so if you subsequently refresh the resource, you need to remember to reset the MIME type. THAT's annoying.
It's the hatred that drives us ;)
You're kidding me Stan? Does it need to be a design refresh that involves changes to the actual File Resource or just a refresh to the DB in general?
Hi Jake,
Why not put it in a "page" and set the "content-type" of the page!.... Should work easy enough!.... Plus you will not loss the "content-type" on design-refresh!
Later
Patrick
That is what I did Patrick. I just didn't like having to do that, when a File Resource should have sufficed.
It happens when you refresh the resource file, and only to the file that you refreshed -- but if you're not aware of the behaviour you can wind up chasing wild geese, since you know you've already set the correct MIME type. Once you are aware of it, it is merely annoying. I'd think that the same resource should probably be treated the same way by default, but that's just me.
There is a strange limitation on MIME type string length.
Max length is 31 symbol. If you use bigger string - you do not get an error message. Domino just truncates long string.
That's a bug.