is there a way to generate a Content-Type header from a file extension in Java?
content-type, java
Solution
Yes, URLConnection.guessContentTypeFromName does exactly this.
Problem
I have a Java application which sometimes has to generate a Content-Type header from a filename alone. Is there a way to estimate the Content-Type for common extensions? (e.g. ".pdf" maps to "application/pdf", etc)