115116117118119120121122123124125
return cmdList.toArray(allCommandArray); } @Override public synchronized CommandInfo getCommand(String mimeType, String cmdName) { CommandInfo cmdInfo = super.getCommand(mimeType, cmdName); if (cmdInfo == null) { cmdInfo = DEFAULT_COMMAND_MAP.getCommand(mimeType, cmdName); } return cmdInfo; }
106107108109110111112113114115
String verb = (String) verbObject; if (!commandsHaveVerb(accumulator, verb)) { List<?> commands = (List<?>) commandMap.get(verb); String className = (String) commands.get(0); accumulator.add(new CommandInfo(verb, className)); } } } }
142143144145146147148149150151152
String verb = (String) verbAsObject; List<?> commands = (List<?>) commandMap.get(verb); for (Object command : commands) { accumulator.add(new CommandInfo(verb, (String) command)); } } } }
155156157158159160161162163164165
public CommandInfo getCommand(String mimeType, String cmdName) { if (mimeType != null) { mimeType = mimeType.toLowerCase(Locale.ENGLISH); } CommandInfo command = null; synchronized (sync) { command = getCommand(mimeType, cmdName, false); if (command != null) { return command;
183184185186187188189190191192193
} String cmdClassName = (String) commands.get(0); if (cmdClassName != null) { return new CommandInfo(commandName, cmdClassName); } } } return null;
2829303132333435
*/ public class MailcapTest extends TestCase { private CommandMap map; public void testTextPlainHandler() { CommandInfo info = map.getCommand("text/plain", "content-handler"); assertEquals(TextPlainHandler.class.getName(), info.getCommandClass()); }
114115116117118119120121122123124
112113114115116117118119120121122