What is an invoker servlet in a Tomcat servlet container?

Avi Kak

The "invoker servlet" is a system-supplied servlet that extracts the name of the requested servlet class from the portion of the URL that comes after "/servlet". The invoker servlet then loads the requested servlet into the container and executes it.

If you look at the contents of the webapp deployment descriptor file, web.xml, in the TOMCAT_HOME/conf directory, you will find the following servlet element at the beginning:


    <servlet>
        <servlet-name>
            invoker
        </servlet-name>
        <servlet-class>
            org.apache.tomcat.servlets.InvokerServlet
        </servlet-class>
    </servlet>

which declares the name and the place of the system-supplied invoker servlet. Shortly thereafter appears the following servlet-mapping element:

    <servlet-mapping>
        <servlet-name>
            invoker
        </servlet-name>
        <url-pattern>
            /servlet/*
        </url-pattern>
    </servlet-mapping>

which tells the container that all requests that begin with "/servlet" (relative to root of the webapp specified by the name that comes before "/servlet") are to be sent to the invoker servlet.

The highly informative posting by Craig McClanahan is the source of the information supplied here.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact