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

Michael Wechner michael.wechner at wyona.com
Mon May 11 21:14:46 CEST 2009


Guillaume Déflache schrieb:
> Hi!
>
> I am replying here as I know not everyone reads Bugzilla ;) and because
> it's probably a friendlier place to discuss things!

Thanks :-) (I prefer it because of nesting comments)
>
> bugzilla at wyona.com schrieb:
>> http://bugzilla.wyona.com/cgi-bin/bugzilla/show_bug.cgi?id=7117
>>
>>            Summary: add more mime-type to guessMimeType(String 
>> extension)
>>            Product: Yanel
>>            Version: 0.9
>>           Platform: PC
>>         OS/Version: Linux
>>             Status: NEW
>>           Severity: normal (C)
>>           Priority: P2
>>          Component: Servlet
>>         AssignedTo: michael.wechner at wyona.org
>>         ReportedBy: simon.litwan at wyona.org
>>          QAContact: yanel-development at wyona.com
>>
>>
>> at the moment not much mime-type are guessed.
>>
>>
>
> As the TODO there says, we should really delegate MIME-type to
> file-extension mapping to a library!

agreed
>
> 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/MimetypesFileTypeMap.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)!

sounds good. I guess this we can also add our own mime types, right?
>
> 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...

Since we currently use Java 5 and higher I guess we would have to do it 
this way
>
> 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=53892
> http://sourceforge.net/projects/mime-util/
> There might also some Jakarta Commons at Apache providing this, haven't
> looked at it.

JAF sounds good, whereas I think the following requirements are:

- Peformance
- Java 5
- Allowing us to add "our own" mime types

Anything else?

Cheers

Michi
>
> Cheers,
>    Guillaume



More information about the Yanel-development mailing list