MIME Types

Rajendra Gutupalli Rajendra.Gutupalli at Sun.COM
Mon Jun 30 04:37:58 PDT 2008


Mark Thornton wrote:
> The Files.probeContentType documentation includes this sentence: "The 
> string is guaranteed to be parsable according to the grammar in the 
> RFC". However, one of the values I get is "image/OLYMPUS Raw Format" 
> --- the RFC doesn't allow spaces in the sub type. Of course this also 
> neither an IANA registered type nor does it start with x-. My registry 
> entry for orf is "image/OLYMPUS Raw Format", so it is difficult to 
> return anything else, but it does mean the guarantee can't be maintained.
>
> Another illegal MIME type
> "app/gg"    app isn't a legal type (example: Documents\My Google 
> Gadgets\Analog Clock-Google.gg)
Hi Mark,

I tried to see whether I can reproduce this behavior in my Ubuntu (GNOME 
Desktop) machine.
I created a mime type "application/rajendra gutupalli" which contains a 
space in sub type and
able to get this mime type using Path.probeContentType(). This mime type 
should have been filtered by the implementation.

Steps to be followed to create mime type in Ubuntu.

 > created mime type file raj.xml file in the /usr/share/mime/packages/ 
directory
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
        <mime-type type="application/rajendra gutupalli">
                <comment>Word document</comment>
        <glob pattern="*.raj"/>
        <alias type="application/vnd.rajendra"/>
        </mime-type>
</mime-info>

 >update mime database with the following command.
rajendra at client24: sudo update-mime-database /usr/share/mime

 >Files.probeContentType() returns the following string.
application/rajendra gutupalli

we will get to know exact behavior for this scenario once Alan is back 
to work.

Thanks
Rajendra.





More information about the nio-discuss mailing list