SE452: Tomcat Setup [3/20] ![]() ![]() ![]() |
Setting up the Invoker Servlet
The invoker servlet is a special servlet that allows you to run and
test your servlets without first adding them in web.xml as both a
servlet node and servlet-mapping node. This can save you some
time during testing and debugging. It basically maps requests for:
http://localhost:8080/yourApp/servlet/ServletName to
the servlet that is deployed into the WEB-INF/classes
directory for yourApp. The ServletName must be fully qualified, so
if you want to invoke se452.example.ExampleServlet, you need
to run http://localhost:8080/yourApp/servlet/se452.example.ExampleServlet.
The invoker servlet was turned off for security purposes.
To enable it, go to "tomcat_home"/conf and edit web.xml. This is a special web.xml file for Tomcat to use for its own purposes. Just search the file for the word "invoker" and uncomment the region that looks like this:
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
and the one that looks like this:
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
This will allow the invoker servlet to work for the entire container