This process is sometimes known as disabling
the invoker servlet, because most servers have a standard servlet that is registered
with the default servlet URLs and simply invokes the real servlet.
There are two main approaches for disabling the default URL:
??? Remapping the /servlet/ pattern in each Web application.
??? Globally turning off the invoker servlet.
It is important to note that, although remapping the /servlet/ pattern in each Web
application is more work than disabling the invoker servlet in one fell swoop, remapping
can be done in a completely portable manner. In contrast, the process for globally
disabling the invoker servlet is entirely server specific. The first following
subsection discusses the per-Web-application strategy of remapping the /servlet/
URL pattern. The next subsection provides details on globally disabling the invoker
servlet in Tomcat.
2.5 Disabling the Invoker Servlet 53
Remapping the /servlet/ URL Pattern
It is quite straightforward to disable processing of URLs that begin with http://host/
webAppPrefix/servlet/ in a particular Web application. All you need to do is create an
error message servlet and use the url-pattern element discussed in the previous
section to direct all matching requests to that servlet. Simply use
/servlet/*as the pattern within the servlet-mapping element.
For example, Listing 2.6 shows a portion of the deployment descriptor that associates
the NoInvokerServlet servlet (Listing 2.
Pages:
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91