Here you can find the source of getContentType(String filename)
public static String getContentType(String filename)
//package com.java2s; //License from project: Open Source License import java.net.URLConnection; public class Main { public static String getContentType(String filename) { return filename.endsWith(".html") ? "text/html" : filename.endsWith(".css") ? "text/css" : filename.endsWith(".js") ? "text/javascript" : URLConnection.guessContentTypeFromName(filename); }/*from ww w . ja v a 2s.c om*/ }