??? By giving a url-pattern of *.foo, you can specify that all URLs of
the form http://host/webAppPrefix/.../blah.foo are handled by the
designated servlet.
Details follow.
Here is an excerpt from web.xml showing a mapping that lets you use URLs like
http://host/webAppPrefix/UrlTest4, http://host/webAppPrefix/UrlTest4/ (note the
slash at the end), h ttp://host/webAppPrefix/UrlTest4/foo/bar to invoke
TestServlet4 declared with the name Test4. Figures 2??“4, 2??“5, and 2??“6 show the
results of invoking TestServlet4 with these URLs, respectively.
Test4
coreservlets.TestServlet4
Test4
/UrlTest4/*
Chapter 2 ?– Controlling Web Application Behavior with web.xml 48
Figure 2??“4 TestServlet4 invoked with http://localhost/deployDemo/UrlTest4.
Figure 2??“5 TestServlet4 invoked with http://localhost/deployDemo/UrlTest4/.
Figure 2??“6 TestServlet4 invoked with http://localhost/deployDemo/UrlTest4/
foo/bar.
2.4 Assigning Names and Custom URLs 49
Likewise, you can use * if you want all URLs ending with a certain extension to
invoke a particular servlet. For example, here is an excerpt from web.xml that lets
you use URLs like http://host/webAppPrefix/foo/bar/baz.urlTest5, http://host/
webAppPrefix/foo.urlTest5 to invoke TestServlet5 declared with the name
Test5.
Pages:
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86