[英]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.