1 17 package org.alfresco.web.config; 18 19 import java.util.HashMap ; 20 import java.util.Map ; 21 22 import org.alfresco.config.ConfigElement; 23 import org.alfresco.config.element.ConfigElementAdapter; 24 25 28 public final class MimeTypeConfigElement extends ConfigElementAdapter 29 { 30 33 public MimeTypeConfigElement() 34 { 35 super(MimeTypesElementReader.ELEMENT_MIMETYPES); 36 } 37 38 43 public MimeTypeConfigElement(Map <String , String > mappings) 44 { 45 super(MimeTypesElementReader.ELEMENT_MIMETYPES); 46 this.mimetypes = mappings; 47 } 48 49 52 public ConfigElement combine(ConfigElement configElement) 53 { 54 MimeTypeConfigElement combined = new MimeTypeConfigElement(this.mimetypes); 55 56 if (configElement instanceof MimeTypeConfigElement) 57 { 58 combined.mimetypes.putAll( ((MimeTypeConfigElement)configElement).mimetypes ); 59 } 60 61 return combined; 62 } 63 64 70 public void addMapping(String ext, String mimetype) 71 { 72 this.mimetypes.put(ext, mimetype); 73 } 74 75 82 public String getMimeType(String ext) 83 { 84 return this.mimetypes.get(ext); 85 } 86 87 private Map <String , String > mimetypes = new HashMap <String , String >(89, 1.0f); 88 } 89 | Popular Tags |