mimeTypeMap.setPreferredMimeTypes(
Sets.newHashSet("text/plain", "text/html", "text/xml"));
mimeTypeMap.setSupportedMimeTypes(Sets.newHashSet(
"application/pdf", "application/msword", "application/xml"));
mimeTypeMap.setExcludedMimeTypes(Sets.newHashSet("text/x-uuencode"));
ProductionTraversalContext traversalContext =
new ProductionTraversalContext();
traversalContext.setMimeTypeMap(mimeTypeMap);
MimeTypeDetector.setTraversalContext(traversalContext);
mimeTypeDetector = new MimeTypeDetector();
}