Memorizing the <mime-mapping> DD tag

You can configure a mapping between an extension and a mime type in the DD. This will probably be the easiest tag to remember, because it just makes sense—you map between an extension and a mime-type, and guess what? In a rare moment of simplicity and clarity, they named the tag sub-elements “extension” and “mime-type”. That means you have to remember only one thing—that the tag elements are named for exactly what they are!

Unless you start thinking of it as “file-type” and “content-type”. But no, you won’t do that. You’ll memorize it just like this.

Declaring a <mime-mapping>

image with no caption

Note

Don’t include the “.” in the extension!

It’s just the characters that make up the extension, not the “.” that separates the file name from the extension.

Note

It’s not <file-type> and <content-type>!

Burn it in—<extension> and <mime-type>.

<extension> and <mime-type>

<extension> and <mime-type>

<extension> and <mime-type>

<extension> and <mime-type>

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.