0 " +
"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);
}
}
5.3 Accessing the Servlet Context from Filters 217
5.3 Accessing the Servlet
Context from Filters
The ReportFilter of the previous section prints a report on the standard output
whenever the designated servlet or JSP page is invoked. A report on the standard
output is fine during development: When you run a server on your desktop, you typically
have a window that displays the standard output. During deployment, however,
you are unlikely to have access to this window. A natural enhancement is to write the
reports into the servlet log file instead of the standard output.
The servlet API provides two log methods: one that takes a simple String and
another that takes a String and a Throwable. These two methods are available
from either the GenericServlet or ServletContext classes. Check your
server??™s documentation for the exact location of the log files that these methods use.
Pages:
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266