SRV.10.2 Specification of Mappings


In the web application deployment descriptor, the following syntax is used to define mappings:

  • A string beginning with a '/' character and ending with a '/*' postfix is used as a path mapping.

  • A string beginning with a '*.' prefix is used as an extension mapping.

  • All other strings are used as exact matches only.

  • A string containing only the '/' character indicates that the servlet specified by the mapping becomes the "default" servlet of the application.

SRV.10.2.1 Implicit Mappings

If the container has an internal JSP container, the *.jsp extension is implicitly mapped to it so that JSP pages may be executed on demand. If the web application defines a *.jsp mapping, its mapping takes precedence over this implicit mapping.

A servlet container is allowed to make other implicit mappings as long as explicit mappings take precedence. For example, an implicit mapping of *.shtml could be mapped by a container to a server side including functionality.

SRV.10.2.2 Example Mapping Set

Consider the set of mappings in Table SRV.10-1.

Table SRV.10-1. Example Set of Maps

Path Pattern

Servlet

/foo/bar/*

servlet1

/baz/*

servlet2

/catalog

servlet3

*.bop

servlet4

The behavior in Table SRV.10-2 would result.

Table SRV.10-2. Incoming Paths Applied to Example Maps

Incoming Path

Servlet Handling Request

/foo/bar/index.html

servlet1

/foo/bar/index.bop

servlet1

/baz

servlet2

/baz/index.html

servlet2

/catalog

servlet3

/catalog/index.html

"default" servlet

/catalog/racecar.bop

servlet4

/index.bop

servlet4

Note that in the case of /catalog/index.html and /catalog/racecar.bop , the servlet mapped to " /catalog " is not used as it is not an exact match and the rule doesn't include the '*' character.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net