All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rt.web.util.WebConst Maven / Gradle / Ivy

There is a newer version: 1.1.17
Show newest version
package com.rt.web.util;

import com.rt.core.constant.RTConst;
import com.rt.core.util.RTUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 常量类
 */
public class WebConst extends RTConst {

    public static final String JPG = "jpg";
    public static final String JPEG = "jpeg";
    public static final String PNG = "png";
    public static final String GIF = "gif";
    public static final String MP4 = "mp4";

    public static final String CONTENT_TYPE_APPLICATION_OCTETSTREAM = "application/octet-stream";
    public static final String CONTENT_TYPE_JPG = "image/jpg";
    public static final String CONTENT_TYPE_JPEG = "image/jpeg";
    public static final String CONTENT_TYPE_PNG = "image/png";
    public static final String CONTENT_TYPE_GIF = "image/gif";
    public static final String CONTENT_TYPE_MP4 = "video/mp4";
    private static final Map CONTENT_TYPE_MAP = new HashMap();

    static {
        CONTENT_TYPE_MAP.put(JPG, CONTENT_TYPE_JPG);
        CONTENT_TYPE_MAP.put(PNG, CONTENT_TYPE_PNG);
        CONTENT_TYPE_MAP.put(GIF, CONTENT_TYPE_GIF);
        CONTENT_TYPE_MAP.put(JPEG, CONTENT_TYPE_JPEG);
        CONTENT_TYPE_MAP.put(MP4, CONTENT_TYPE_MP4);
    }

    public static void putContentType(String extName, String contentType) {
        CONTENT_TYPE_MAP.put(extName, contentType);
    }

    public static final String getContentType(String extName) {
        if (RTUtil.isEmpty(extName)) {
            return null;
        }
        return (String) CONTENT_TYPE_MAP.get(extName);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy