On Fri, 7 Feb 2003, Felipe Schnack wrote:

> Date: 07 Feb 2003 17:11:03 -0200
> From: Felipe Schnack <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: RE: servlet URL
>
>   I'm writing a servlet that requires to be a Singleton (much like
> Struts' servlet), and I have some other objects that need to know the
> URL of this Servlet to make some redirects to it... so I need this
> servlet to have a method that return its URL, as in web.xml
>   I can get this from HttpServletRequest??
>

You can get the part that matched on this request by calling
request.getServletPath(), and use that to infer the mapping.

Or, you can look at the source and do what Struts actually does :-), which
is to parse the web.xml file itself.  In a 1.1 release, look at the
initServlet() method of ActionServlet.

Craig McClanahan

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

Reply via email to