public static String getTypeByPath (String path) {
        if (path == null) {
            return "text/html";
        }
        final String ext = path.substring(path.lastIndexOf(".") + 1, path.length()).toLowerCase();
        String extType = null;

        if (ext.equals("html")) {
            extType = "text/html";
        }
        else if (ext.equals("jpg") || ext.equals("jpeg")) {
            extType = "image/jpeg";
        }
        else if (ext.equals("css")) {
            extType = "text/css";
        }
        else if (ext.equals("js")) {
            extType = "text/javascript";
        }
        else if (ext.equals("png")) {
            extType = "image/png";
        }
        else if (ext.equals("gif")) {
            extType = "image/gif";
        }
        else if (ext.equals("swf")) {
            extType = "application/x-shockwave-flash";
        }

        return extType;
    }