You can try to determine the content type of a file based on the file extension
Please note that the logic does try to guess the content type based on the filename. If the filename is wrong (no extension / wrong extension) the content-type header will most probably be wrong.
Assuming you have a file name somewhere:
String filename = "index.html";
int indexOfFinalDot = filename.lastIndexOf(".");
if (indexOfFinalDot > 0) {
String fileExtentsion = filename.substring(indexOfFinalDot + 1).toLowerCase();
if ("html".equals(fileExtentsion)) {
//your logic here
}
}