Guess the Content-type from Filename

Java has a helpful little function for guessing the content-type based on the file name:


You can check out — or customize — the mappings which are stored in $JRE_HOME/lib/

So if you’re serving up a file and you’re not quite sure what content-type to use, let Java take a guess.

Comments are closed.