I am looking among the standard libraries (like apache commons, jax, jboss, javax) for an interface or enum that lists the values of all the standard mime-type (aka content-
Java 7 to the rescue!
You can either pass the file or the file name and it will return the MIME type.
String mimeType = MimetypesFileTypeMap .getDefaultFileTypeMap() .getContentType(attachment.getFileName());
http://docs.oracle.com/javase/7/docs/api/javax/activation/MimetypesFileTypeMap.html