Turns out Graeme did some work in 2.0 to put this feature in, but I don't think it's documented anywhere really. So I thought I would do a quick post on this to help out others who are looking for this this same information.
Simply inject the bean into your service, controller, domain class, etc and call the getMimeTypeForExtension method. Another tip: use the commons-io FilenameUtils.getExtension to get the extension from the file name without doing any manual parsing:
class MyController {
DefaultMimeUtility grailsMimeUtility
String getMimeTypeForFileName(String filename) {
return grailsMimeUtility.getMimeTypeForExtension(FilenameUtils.getExtension(filename))
}
}