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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.