You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by George Wen <we...@hotmail.com> on 2013/07/02 16:52:59 UTC

Update mimetypes.xml without recompiling tika

I am trying to use tika detectors to detect file mime types in my project. Since I need to handle some rare mime types, the abilities and easiness to add custom mime types are important to me. Is it possible to let tika use an external tika-mimetypes.xml so that I don't need to recompile tika-app.jar every time a mime type is added?
I am able to use MimetypesFactory to create MimeTypes instance based on external mimetypes.xml, but MimeTypes only use MagicNumberDetector instead of all available detectors like DefaultDetector does? I prefer a way to use all detectors like DefaultDetector does and still be able to link to an external mimetypes.xml.
Your help is greatly appreciated
Regards,George 		 	   		  

RE: Update mimetypes.xml without recompiling tika

Posted by George Wen <we...@hotmail.com>.
I just tried out the solution. It works perfectly.
Thanks,George


> Date: Tue, 2 Jul 2013 16:17:49 +0100
> From: apache@gagravarr.org
> To: user@tika.apache.org
> Subject: Re: Update mimetypes.xml without recompiling tika
> 
> On Tue, 2 Jul 2013, George Wen wrote:
> > I am trying to use tika detectors to detect file mime types in my 
> > project. Since I need to handle some rare mime types, the abilities and 
> > easiness to add custom mime types are important to me. Is it possible to 
> > let tika use an external tika-mimetypes.xml so that I don't need to 
> > recompile tika-app.jar every time a mime type is added?
> 
> Can you not just make use of a custom-mimetypes.xml file? See 
> http://tika.apache.org/1.0/parser_guide.html#Add_your_MIME-Type
> 
> To run with it, you'd need to something like
>    java -classpath /path/to/root/of/custom/mimetypes:/path/to/tika-app.jar
>      org.apache.tika.cli.TikaCLI --list-supported-types
> 
> When that shows your custom mimetypes, you're good to go!
> 
> Nick
 		 	   		  

Re: Update mimetypes.xml without recompiling tika

Posted by Nick Burch <ap...@gagravarr.org>.
On Tue, 2 Jul 2013, George Wen wrote:
> I am trying to use tika detectors to detect file mime types in my 
> project. Since I need to handle some rare mime types, the abilities and 
> easiness to add custom mime types are important to me. Is it possible to 
> let tika use an external tika-mimetypes.xml so that I don't need to 
> recompile tika-app.jar every time a mime type is added?

Can you not just make use of a custom-mimetypes.xml file? See 
http://tika.apache.org/1.0/parser_guide.html#Add_your_MIME-Type

To run with it, you'd need to something like
   java -classpath /path/to/root/of/custom/mimetypes:/path/to/tika-app.jar
     org.apache.tika.cli.TikaCLI --list-supported-types

When that shows your custom mimetypes, you're good to go!

Nick