O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required