With docx files, i retrieve application/x-tika-ooxml
, but i should retrieve application/vnd.openxmlformats-officedocument.wordprocessingml.document
instead
Here is my method :
public String retrieveMimeType(InputStream stream) throws IOException, TikaException {
TikaInputStream tikaStream = null;
TikaConfig tikaConfig = new TikaConfig();
MediaType mediaType = null;
try {
mediaType = tikaConfig.getDetector().detect(TikaInputStream.get(stream), new Metadata());
} catch (Throwable t) {
throw t;
} finally {
if (tikaStream != null) {
try {
tikaStream.close();
} catch (IOException e) {
}
}
}
return mediaType.toString();
}
And my dependecies :
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.27</version>
</dependency>
I use tika-core, and tika-parsers for retrieve the right mimetype, but it still give me the bad mimetype...