public static MimeType get(String typeOrExtension) { for (MimeType m : EnumSet.allOf(MimeType.class)) { if (m.getType().equalsIgnoreCase(typeOrExtension) || m.getExtension().equalsIgnoreCase(typeOrExtension)) { return m; } } return MimeType.PNG; /*Iterator it = lookup.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry)it.next(); if } // Check first if we give in the name of the mime, like svg, png, pfd MimeType mime = MimeType.valueOf(type.toUpperCase()); if (mime != null) { return mime; } // if not matched above, check if we can lookup the mime based on the content-type mime = lookup.get(type); if (mime != null) { return mime; } // else return default return MimeType.PNG;*/ }