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

Michael Wechner michael.wechner at wyona.com
Wed Jan 20 12:34:31 CET 2010


simon wrote:
> 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.

done:

svn ci -m "svg mime type added" 
src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Sending        src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Transmitting file data .
Committed revision 47177.
>
> 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.

I am not sure I understand. You mean Bugzilla does not send you a 
password if you create a new account?

@Simone, Guillaume: Do you have an idea what might be wrong?

Thanks

Michi
>
> 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éflache schrieb:
>> Guillaume Déflache 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/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)!
>>>
>>> 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=53892
>>> 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/MimeTypes.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! ;) ]
>



More information about the Yanel-development mailing list