Is there a helper function to find a mime type corresponding to an extension
Mime types corresponding to an extension is available over here. We currently have the following code to translate this for the most commonly used extension types.
String getContentType(String extension) {
if (extens开发者_运维问答ion.equals("png") || extension.equals("gif")
|| extension.equals("ico") || extension.equals("tiff")) {
contentType = "image/" + extension;
} else if (extension.equals("jpg") || extension.equals("jpeg")) {
contentType = "image/jpeg";
}
........
}
But is there a function in a open source library which provides this complete mapping?
精彩评论