setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
""Transitional//EN\">\n";
String title = "Invoker Servlet Disabled.";
out.println
(docType +
"\n" +
"
" + title + "\n" +
"\n" +
"
" + title + "
\n" +
"Sorry, access to servlets by means of\n" +
"URLs that begin with\n" +
"http://host/webAppPrefix/servlet/\n" +
"has been disabled.\n" +
"");
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
2.5 Disabling the Invoker Servlet 55
Figure 2??“10 Unsuccessful attempt to invoke the TestServlet1 servlet by means of the
default URL. The invoker servlet is disabled.
Globally Disabling the Invoker: Tomcat
Tomcat 5 turns off the invoker servlet by default. It does this in the same way that we
turned it off in the previous section: by means of a url-mapping element in
web.xml. The difference is that Tomcat uses a server-specific global web.xml file that
is stored in install_dir/conf, whereas we used the standard web.xml file that is stored
in the WEB-INF directory of each Web application.
Thus, to turn off the invoker servlet in Tomcat 5, you simply comment out the
/servlet/* URL mapping entry in install_dir/conf/web.xml, as shown here.
Pages:
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93