tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <>
Subject Re: servlet URL
Date Fri, 07 Feb 2003 19:20:14 GMT

Felipe Schnack wrote:
>   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

Presumably this doesn't change, right?  You could either store it as a 
constant (public static final String) of the servlet or as a web.xml 

>   I can get this from HttpServletRequest??

You can get various parts of the URI from the HttpServletRequest in that 
particular servlet, since presumably the request contains the URL that 
was used to fetch the servlet.  But doesn't sound like what you are 
looking for (a way to determine the URL from within other classes, not 
the servlet).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message