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

Guillaume Déflache guillaume.deflache at wyona.com
Tue May 12 12:20:33 CEST 2009


Hi!

Michael Wechner schrieb:
> Guillaume Déflache schrieb:
>> 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?

That's what I was trying to say above ;) either in a mime.types file (in 
Apache format I think) or through an API.


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

Sure. 1.1.1 does only bring minor things 
http://java.sun.com/javase/technologies/desktop/javabeans/glasgow/jaf-changes.txt 
so you can stay with that as before.
However we may have to endorse it for Java 6 compatibility like we do 
with StAX, or maybe it's the very same version so we do not need to do 
that either.
FYI a `grep` in Yanel trunk and contributions for '"activation"' says we 
currently use activation-1.1.jar in the "contact-form", "atom" and 
"atom-entry" resource-types.


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

...should be better than the submitted 
http://bugzilla.wyona.com/cgi-bin/bugzilla/attachment.cgi?id=1136&action=view 
patch which is O(N) where N is the number of registered extensions.
I hope JAI is using some kind of hashmap which would be O(1).


> - Java 5

I guess you mean Java 5 compatible, not required! ;)


> - Allowing us to add "our own" mime types

Check! :)


> Anything else?

Nothing I can think of ATM.

Cheers,
    Guillaume


More information about the Yanel-development mailing list