You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by Luís Filipe Nassif <lf...@gmail.com> on 2015/01/13 03:09:20 UTC
External custom-mimetypes.xml
Hi,
I would like to load a custom-mimetypes.xml file from a directory, not from
the jar files. Is it possible?
Thank you,
Luis Nassif
Re: External custom-mimetypes.xml
Posted by Nick Burch <ap...@gagravarr.org>.
On Tue, 13 Jan 2015, Luís Filipe Nassif wrote:
> And Nick, any alternative to this package like path? I have used it
> before but I think it is a bit unfriendly to be edited by the final
> user.
It needs to be something unique like that, so we don't get accidental
false positives.
For production use, I would suggest you pop your custom-mimetypes.xml file
into a jar, and add that jar to your classpath. That should be much safer
and easier for users. You'd normally only use raw directory paths in
development
Nick
Re: External custom-mimetypes.xml
Posted by Luís Filipe Nassif <lf...@gmail.com>.
Thank you guys.
But with TikaConfig I think I need to redefine all default mimetypes?
And Nick, any alternative to this package like path? I have used it before
but I think it is a bit unfriendly to be edited by the final user.
Thank you again,
Luis
Em 13/01/2015 06:47, "Nick Burch" <ap...@gagravarr.org> escreveu:
> On Tue, 13 Jan 2015, Luís Filipe Nassif wrote:
>
>> I would like to load a custom-mimetypes.xml file from a directory, not
>> from the jar files. Is it possible?
>>
>
> Yup, I do it quite often when testing
>
> Just make sure that you have a directory structure like:
> somewhere/org/apache/tika/mime/custom-mimetypes.xml
>
> Then ensure that that "somewhere" is on your classpath, eg
>
> find test-mimetypes -type f
> test-mimetypes/org/apache/tika/mime/custom-mimetypes.xml
>
> java -classpath tika-app-1.8-SNAPSHOT.jar:test-mimetypes
> org.apache.tika.cli.TikaCLI --detect foo.bin
>
> That'll run the tika app, along with your additional custom mimetype
> definition from the "test-mimetypes" directory
>
> Nick
Re: External custom-mimetypes.xml
Posted by Nick Burch <ap...@gagravarr.org>.
On Tue, 13 Jan 2015, Luís Filipe Nassif wrote:
> I would like to load a custom-mimetypes.xml file from a directory, not
> from the jar files. Is it possible?
Yup, I do it quite often when testing
Just make sure that you have a directory structure like:
somewhere/org/apache/tika/mime/custom-mimetypes.xml
Then ensure that that "somewhere" is on your classpath, eg
find test-mimetypes -type f
test-mimetypes/org/apache/tika/mime/custom-mimetypes.xml
java -classpath tika-app-1.8-SNAPSHOT.jar:test-mimetypes org.apache.tika.cli.TikaCLI --detect foo.bin
That'll run the tika app, along with your additional custom mimetype
definition from the "test-mimetypes" directory
Nick
Re: External custom-mimetypes.xml
Posted by Lewis John Mcgibbney <le...@gmail.com>.
Yes it is possible and it is absolutely OK. I do it all the time.
http://tika.apache.org/1.6/api/index.html?org/apache/tika/config/TikaConfig.html
Please try out loading the constructor as all other accessory are GET's.
Lewis
On Mon, Jan 12, 2015 at 9:09 PM, Luís Filipe Nassif <lf...@gmail.com>
wrote:
> Hi,
>
> I would like to load a custom-mimetypes.xml file from a directory, not
> from the jar files. Is it possible?
>
> Thank you,
> Luis Nassif
>
--
*Lewis*