[Yanel-dev] [Bug 7117] New: add more mime-type to guessMimeType(String extension)

simon simon at 333.ch
Wed Jan 20 11:30:57 CET 2010


hi all

i have again a problem with a missing mime-type definition. i would like =

to update the svg-edit resource type =

(http://trac.yanel-contribution.3k3.org/wiki/svg-edit) to the newest =

version of svg-edit. since it uses svg icons, i need svg files served =

via resource-type htdocs with the right mime-type.
i would very appreciate if one could apply the attached patch. i know =

you suggested to use a lib for this. but i don't have much time at the =

moment and i'm not sure how long it takes to implement the below =

suggested way. and the patch is just one line.

i attached this patch to the mail since my old bugzilla account is =

deleted, and i don't get the password mail after i made a new one. maybe =

someone could take care of this as well.

cheers
simon

ps: i still would like to see my first patch to be applied. there is =

always a better way of doing something, but if we have something that =

works why not using it until someone has time/will to implement the =

better way? in this case it's certainly easy to refactor later on.

Guillaume D=E9flache schrieb:
> Guillaume D=E9flache schrieb:
>> As the TODO there says, we should really delegate MIME-type to
>> file-extension mapping to a library!
>>
>> The good thing is, one already exists, and a standard one at that: JAF
>> http://java.sun.com/javase/technologies/desktop/javabeans/jaf/
>> So why not use javax.activation.MimetypesFileTypeMap from JAF?
>> http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/activation/Mimetypes=
FileTypeMap.html =

>>
>> If we do we should be able to configure all of this in
>> META-INF/mime.types *and* programmatically, or even not at all as the
>> JVM defaults may be enough, and then simply use new
>> MimetypesFileTypeMap().getContentType(java.lang.String filename)!
>>
>> JAF (not sure which version) is included by default from J2SE 6 onwards
>> and IIRC is already in J2EE so we probably should add it as an endorsed
>> library.
>> Note: it looks like the standard Yanel distribution was already pulling
>> activation-1.1.jar...
>>
>> If your needs are not met by JAF you might also want to have a look at
>> the (Apache-licensed) mime-util library
>> http://www.theserverside.com/news/thread.tss?thread_id=3D53892
>> http://sourceforge.net/projects/mime-util/
>> There might also some Jakarta Commons at Apache providing this, haven't
>> looked at it.
>
> FYI Nutch also has a similar one named "getMimeType" in the MimeTypes =

> class: =

> http://lucene.apache.org/nutch/apidocs/org/apache/nutch/util/mime/MimeTyp=
es.html =

>
>
> However it seems Nutch has never been available in the main Maven =

> repo! :( Any idea how to get that class from Maven?
> [ BTW I already saw in a customer project using some other Java source =

> classes from Nutch that were copied verbatim, maybe that's the reason! =

> ;) ]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: svg-mime-type-to-guess.diff
Type: text/x-diff
Size: 688 bytes
Desc: not available
Url : http://lists.wyona.org/pipermail/yanel-development/attachments/201001=
20/fb847c6b/svg-mime-type-to-guess.bin


More information about the Yanel-development mailing list