The Tomcat FAQ has a cautionary note about the invoker servlet:

http://jakarta.apache.org/tomcat/faq/misc.html#evil

> call http://localhost:8080/web_app_context/servlet/<servlet_name>

That *should* work, assuming <servlet_name> is the fully qualified name of
the servlet you are trying to invoke. (And assuming everything else is
correct, too.)

> I do not wish to change the web apps WEB.XML
> file just for testing.

Registering and mapping servlets in the deployment descriptor is correct
thing. A servlet is not much use if you do not at least register it - that
allows you to forward requests to it from other servlets. Mapping is
optional: it allows you to invoke the servlet with a URL, which is what a
browser does.

> Is there a simple way to test a servlet, where
> I can create a servlet, put it someplace and call
> it via a standard URL??

Register a servlet, and call it (say) "Test":

<servlet>
     <servlet-name>
        Test
     </servlet-name>
     <servlet-class>
         com.foo.bar.MyNewServlet
     </servlet-class>
</servlet>  

Then specify a convenient mapping:

<servlet-mapping>
    <servlet-name>
        Test
    </servlet-name>
    <url-pattern>
        /test
    </url-pattern>
</servlet-mapping> 

That allows you to invoke MyNewServlet with just '/test' in the URL.

When you want to test another servlet, just replace the fully qualified name
'com.foo.bar.MyNewServlet' to that of the newer servlet.

Good luck..

Harry Mantheakis
London, UK



> I don't understand the invoker servlet. I understand that you have to
> uncomment it from the default web.xml file (did that). BUT, If I create a
> servlet and put it "web_app_context/WEB-INF/classes", then
> call http://localhost:8080/web_app_context/servlet/<servlet_name> WHY does
> that not work?? I simply want to test a servlet - I do not wish to change
> the web apps WEB.XML file just for testing. Is there a simple way to test a
> servlet, where I can create a servlet, put it someplace and call it via a
> standard URL??
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to