geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r149310 - geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java
Date Mon, 31 Jan 2005 21:56:20 GMT
Author: dims
Date: Mon Jan 31 13:56:18 2005
New Revision: 149310

URL: http://svn.apache.org/viewcvs?view=rev&rev=149310
Log:
trying to get axis working with our activation jar and SUN's javamail jar

- drop the leading / before META-INF
- When user code is looking for multipart/related, look for that first and then fall back
to multipart/*


Modified:
    geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java

Modified: geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java?view=diff&r1=149309&r2=149310
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java (original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/MailcapCommandMap.java Mon Jan
31 13:56:18 2005
@@ -31,6 +31,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Collection;
+import java.util.Collections;
 
 /**
  * @version $Rev$ $Date$
@@ -59,7 +61,7 @@
         // process /META-INF/mailcap resources
         try {
             cl = MailcapCommandMap.class.getClassLoader();
-            Enumeration e = cl.getResources("/META-INF/mailcap");
+            Enumeration e = cl.getResources("META-INF/mailcap");
             while (e.hasMoreElements()) {
                 url = ((URL) e.nextElement());
                 try {
@@ -271,11 +273,15 @@
     }
 
     public synchronized CommandInfo getCommand(String mimeType, String cmdName) {
-        Map commands = (Map) preferredCommands.get(mimeType.toLowerCase());
-        if (commands == null) {
-            return null;
-        }
-        return (CommandInfo) commands.get(cmdName.toLowerCase());
+        HashMap commands = (HashMap) preferredCommands.get(mimeType.toLowerCase());
+        if(commands != null)
+            return (CommandInfo) commands.get(cmdName.toLowerCase());
+        int i = mimeType.indexOf('/');
+        String mimeType2 = mimeType.substring(0, i + 1) + "*";
+        HashMap commands2 = (HashMap) preferredCommands.get(mimeType2.toLowerCase());
+        if(commands2 != null)
+            return (CommandInfo) commands2.get(cmdName.toLowerCase());
+        return null;
     }
 
     public synchronized DataContentHandler createDataContentHandler(String mimeType) {



Mime
View raw message