not sure that what you are trying to do makes sense? why do you need the servlet to return its url? You configure the URL in the web.xml file, so you should already know what it is and not have to ask the servlet itself.
This is from the spec "By default, there must be only one instance of a servlet class per servlet definition in a container. In the case of a servlet that implements the SingleThreadModel interface, the servlet container may instantiate multiple instances of that servlet so that it can handle a heavy request load while still serializing requests to a single instance." so by default the servlet is a singleton. and for the other objects, give them the url through a config file Filip -----Original Message----- From: Felipe Schnack [mailto:[EMAIL PROTECTED]] Sent: Friday, February 07, 2003 11:11 AM To: Tomcat Users List 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?? On Fri, 2003-02-07 at 17:04, Filip Hanik wrote: > take a look at the javax.servlet.http.HttpServletRequest API, > it has a bunch of methods that you can use to retrieve all kinds of info about the >request. > > but if you mean how do you retrieve the info that is in web.xml for your particular >servlet, > give us the scenario where you would like this info and how? > > Filip > > > -----Original Message----- > From: Felipe Schnack [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 07, 2003 10:58 AM > To: Tomcat Users List > Subject: servlet URL > > > How I retrieve the URL an HttpServlet instance is mapped to? > > -- > > Felipe Schnack > Analista de Sistemas > [EMAIL PROTECTED] > Cel.: (51)91287530 > Linux Counter #281893 > > Centro Universitário Ritter dos Reis > http://www.ritterdosreis.br > [EMAIL PROTECTED] > Fone/Fax.: (51)32303341 > > > --------------------------------------------------------------------- > 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] > -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Centro Universitário Ritter dos Reis http://www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303341 --------------------------------------------------------------------- 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]