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.


    • avatar
    • Blop
    • Thu 4 Aug 2005 07:51 AM

    > "I guess most of you knew about being able to change mime-types of File Resources?"


    Useful to know about the File Identification settings, though. Does this update the server's httpd.cnf file?

    • avatar
    • Jake
    • Thu 4 Aug 2005 07:56 AM

    Know-it-all !

    Not sure if it update's it or not Blop. A http restart is needed though, so maybe so.

  1. 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.

  2. 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.

  3. It's the hatred that drives us ;)

    • avatar
    • Jake
    • Thu 4 Aug 2005 09:05 AM

    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?

    • avatar
    • Patrick
    • Thu 4 Aug 2005 01:54 PM

    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!



    • avatar
    • Jake
    • Thu 4 Aug 2005 02:09 PM

    That is what I did Patrick. I just didn't like having to do that, when a File Resource should have sufficed.

  4. 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.

    • avatar
    • Rafael
    • Sat 7 Jun 2008 04:53 AM

    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.

Your Comments


About This Page

Written by Jake Howlett on Thu 4 Aug 2005

Share This Page

# ( ) '


The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social

About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »


Here are the external links posted on the same day.

More links are available in the archive »

More Content