You'd need to parse the web.xml file yourself in order to do this.  The
easiest way would be to use ServletContext.getResourceAsStream() to get an
InputStream to the "/WEB-INF/web.xml" resource, and feed it to your XML
parser via JAXP APIs.

Tomcat itself uses a package called commons-digester for this sort of
thing, and you might find it useful as well.  See:

  http://jakarta.apache.org/commons/digester/

for more info.

Craig


On Wed, 9 Oct 2002, Jason Novotny wrote:

> Date: Wed, 09 Oct 2002 18:58:01 +0200
> From: Jason Novotny <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: obtaining servlet classname
>
>
> Hi,
>
>     I can successfully get the servlet name using
> ServletConfig.getServletName() but how do I get the class expressed in
> the web.xml file? e.g. I have the following:
>
> <servlet id="login">
>         <servlet-name>Login</servlet-name>
>
> <servlet-class>org.gridlab.gridsphere.portlets.core.LoginPortlet</servlet-class>
>         <init-param>
>             <param-name>portletID</param-name>
>
> <param-value>org.gridlab.gridsphere.portlets.core.LoginPortlet.129</param-value>
>         </init-param>
>         <load-on-startup>3</load-on-startup>
> </servlet>
>
>     How do I get <servlet-class> ? Also, how could I get other web app
> deployment descriptor info such as the id expressed in <servlet id="xxx">?
>
>     Thanks, Jason
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


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

Reply via email to