[英]is there a way to generate a Content-Type header from a file extension in Java?
[英]Is it possible to use the content-type of a file to determine its filetype in Java?
如果是这样,我该怎么做?
我正在尝试编写一种采用内容类型并返回是否为JSON文件的方法。
这是一个函数,该函数从HTTP请求中获取内容类型字符串,如果内容类型为JSON类型,则返回TRUE,否则返回FALSE。
public static boolean isJsonContentType(String contentType) {
return (contentType.equals("application/json"));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.