Search in sources :

Example 1 with DataContentHandler

use of javax.activation.DataContentHandler in project sling by apache.

the class OsgiMailcapCommandMap method findDataContentHandler.

private DataContentHandler findDataContentHandler(String mimeType, boolean fallback) {
    for (Map.Entry<Bundle, MailcapFile> entry : db.entrySet()) {
        Map<?, ?> commandMap = fallback ? entry.getValue().getMailcapFallbackList(mimeType) : entry.getValue().getMailcapList(mimeType);
        if (commandMap != null) {
            List<?> v = (List<?>) commandMap.get("content-handler");
            if (v == null) {
                continue;
            }
            String name = (String) v.get(0);
            DataContentHandler dch = getDataContentHandler(name, entry.getKey());
            if (dch != null) {
                return dch;
            }
        }
    }
    return null;
}
Also used : DataContentHandler(javax.activation.DataContentHandler) Bundle(org.osgi.framework.Bundle) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) CommandMap(javax.activation.CommandMap) Map(java.util.Map) MailcapFile(com.sun.activation.registries.MailcapFile)

Aggregations

MailcapFile (com.sun.activation.registries.MailcapFile)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CommandMap (javax.activation.CommandMap)1 DataContentHandler (javax.activation.DataContentHandler)1 Bundle (org.osgi.framework.Bundle)1