You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Gary Long <ga...@gmx.fr> on 2009/09/11 17:01:40 UTC

problem with .doc and .xls mimetype

Hi :)

i have a problem with the function MimeTable.getContentTypeFor(file). It
doesn't work with .doc files (and other microsoft Office documents). the
function return the default mimetype -> application/octet-stream.
It looks like there is no reference to .doc mimetype in the mimetable :/ 

Can you help me please? 

thanks :)
-- 
View this message in context: http://www.nabble.com/problem-with-.doc-and-.xls-mimetype-tp25402655p25402655.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: problem with .doc and .xls mimetype

Posted by Vijay Katariya <ka...@gmail.com>.
Hi,


Use the method of import javax.activation.MimetypesFileTypeMap to getting
mime type.
String mimeType = new MimetypesFileTypeMap().getContentType(file.getName());



On Fri, Sep 11, 2009 at 3:01 PM, Gary Long <ga...@gmx.fr> wrote:

>
> Hi :)
>
> i have a problem with the function MimeTable.getContentTypeFor(file). It
> doesn't work with .doc files (and other microsoft Office documents). the
> function return the default mimetype -> application/octet-stream.
> It looks like there is no reference to .doc mimetype in the mimetable :/
>
> Can you help me please?
>
> thanks :)
> --
> View this message in context:
> http://www.nabble.com/problem-with-.doc-and-.xls-mimetype-tp25402655p25402655.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Re: problem with .doc and .xls mimetype

Posted by Sébastien Launay <se...@anyware-tech.com>.
Hi Gary,

This is clearly not a Jackrabbit related problem.
But you can find more information here [1].

Note that using sun.net.www.MimeTable is specific to Sun
Java implementation and therefore can be dropped in a
JVM update, but more importantly it will not be supported
in other Java implementations.

[1] http://www.rgagnon.com/javadetails/java-0487.html

--
Sébastien Launay

Le 11/09/2009 17:01, Gary Long a écrit :
> Hi :)
>
> i have a problem with the function MimeTable.getContentTypeFor(file). It
> doesn't work with .doc files (and other microsoft Office documents). the
> function return the default mimetype -> application/octet-stream.
> It looks like there is no reference to .doc mimetype in the mimetable :/ 
>
> Can you help me please? 
>
> thanks :)

Re: problem with .doc and .xls mimetype

Posted by Rodrigo Meza <ro...@gmail.com>.
a solution that worked for me was to use jmimemagic (
http://sourceforge.net/projects/jmimemagic/):

       byte [] data=....;
        String mimetype = Magic.getMagicMatch(data).getMimeType();

On Mon, Sep 14, 2009 at 12:11 PM, Gary Long <ga...@gmx.fr> wrote:

>
> Thank you for helping me :)
>
> I'll try to use tika.
>
>
>

Re: problem with .doc and .xls mimetype

Posted by Gary Long <ga...@gmx.fr>.
Thank you for helping me :)

I'll try to use tika.


Gary Long wrote:
> 
> Hi :)
> 
> i have a problem with the function MimeTable.getContentTypeFor(file). It
> doesn't work with .doc files (and other microsoft Office documents). the
> function return the default mimetype -> application/octet-stream.
> It looks like there is no reference to .doc mimetype in the mimetable :/ 
> 
> Can you help me please? 
> 
> thanks :)
> 

-- 
View this message in context: http://www.nabble.com/problem-with-.doc-and-.xls-mimetype-tp25402655p25438719.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.