URLs and protocol handlers

We've seen how a directory service implementation lets us abstract away the details of how a context's resources are made available. But that is only part of the story.

In this section, we'll look at how we might plug into Java's standard protocol handler mechanism to make the identification and retrieval of resources easy and intuitive. So please fasten your seatbelts as we enter the exotic world of Java protocol handlers!

Accessing resources

When a servlet container element, such as a servlet or filter, needs to access a static resource, it should avoid using hardcoded paths to that file. Hardcoding paths can hurt the portability of an application across servlet containers or result in failure when the web application ...

Get Tomcat 6 Developer's Guide 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.