class MimeTypes {

    public String getMimeByExtension(String filename) {
        String type = null;

        if (filename != null) {
            int i = -1;
            while (type == null) {
                i = filename.indexOf(".", i + 1);

                if (i < 0 || i >= filename.length())
                    break;

                String ext = StringUtils.asciiToLowerCase(filename.substring(i + 1));
                type = _mimeMap.get(ext);
                if (type == null)
                    type = DFT_MIME_MAP.get(ext);
            }
        }

        if (type == null) {
            type = _mimeMap.get("*");
            if (type == null) {
                type = DFT_MIME_MAP.get("*");
            }
        }

        return type;
    }

    public  MimeTypes();

}