Category Archives: Java

Determining MIME type by file extension

A quick way to determine the MIME type for a file is to check the extension of the file against a mapping of known extensions to MIME types. The Apache web server provides a good list of known mappings that is easy to parse

Read more »

Apache Velocity – Read Templates from JAR

Apache Velocity comes bundled with different resource loaders, but none of them are really suitable for reading templates that are bundled in your JAR. By using a String Resource Loader, templates can be loaded using getResourceAsStream (or anything else that can yield a String).

Read more »