manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1632283 - /manifoldcf/branches/CONNECTORS-1074/framework/core/src/main/java/org/apache/manifoldcf/core/extmimemap/ExtensionMimeMap.java
Date Thu, 16 Oct 2014 12:03:02 GMT
Author: kwright
Date: Thu Oct 16 12:03:01 2014
New Revision: 1632283

URL: http://svn.apache.org/r1632283
Log:
Use tika to implement extension mapping

Modified:
    manifoldcf/branches/CONNECTORS-1074/framework/core/src/main/java/org/apache/manifoldcf/core/extmimemap/ExtensionMimeMap.java

Modified: manifoldcf/branches/CONNECTORS-1074/framework/core/src/main/java/org/apache/manifoldcf/core/extmimemap/ExtensionMimeMap.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1074/framework/core/src/main/java/org/apache/manifoldcf/core/extmimemap/ExtensionMimeMap.java?rev=1632283&r1=1632282&r2=1632283&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1074/framework/core/src/main/java/org/apache/manifoldcf/core/extmimemap/ExtensionMimeMap.java
(original)
+++ manifoldcf/branches/CONNECTORS-1074/framework/core/src/main/java/org/apache/manifoldcf/core/extmimemap/ExtensionMimeMap.java
Thu Oct 16 12:03:01 2014
@@ -20,43 +20,16 @@
 package org.apache.manifoldcf.core.extmimemap;
 
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
-import java.util.*;
+import org.apache.tika.Tika;
 
 /** Map file extension to a mime type.
 */
 public class ExtensionMimeMap
 {
-  protected final static Map<String,String> mimeMap;
-  static {
-    mimeMap = new HashMap<String,String>();
-    mimeMap.put("xml", "text/xml");
-    mimeMap.put("csv", "text/csv");
-    mimeMap.put("json", "application/json");
-    mimeMap.put("pdf", "application/pdf");
-    mimeMap.put("rtf", "text/rtf");
-    mimeMap.put("html", "text/html");
-    mimeMap.put("htm", "text/html");
-    mimeMap.put("doc", "application/msword");
-    mimeMap.put("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
-    mimeMap.put("ppt", "application/vnd.ms-powerpoint");
-    mimeMap.put("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
-    mimeMap.put("xls", "application/vnd.ms-excel");
-    mimeMap.put("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
-    mimeMap.put("odt", "application/vnd.oasis.opendocument.text");
-    mimeMap.put("ott", "application/vnd.oasis.opendocument.text");
-    mimeMap.put("odp", "application/vnd.oasis.opendocument.presentation");
-    mimeMap.put("otp", "application/vnd.oasis.opendocument.presentation");
-    mimeMap.put("ods", "application/vnd.oasis.opendocument.spreadsheet");
-    mimeMap.put("ots", "application/vnd.oasis.opendocument.spreadsheet");
-    mimeMap.put("txt", "text/plain");
-    mimeMap.put("log", "text/plain");
-    mimeMap.put("aspx", "text/html");
-  }
-
   /** Map extension to mime type */
   public static String mapToMimeType(String extension)
   {
-    return mimeMap.get(extension.toLowerCase(java.util.Locale.ROOT));
+    return new Tika().detect("x."+extension);
   }
   
 }



Mime
View raw message