tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Schnack <>
Subject Re: servlet URL
Date Fri, 07 Feb 2003 19:24:12 GMT
  Sorry, context-parameter? But then I wouldn't have (again) my
servlet's URL written in two different places? This kind of thing
worries me, because somebody can change in one place but not on another.
  I think I can understand the HttpServletRequest way of doing it... but
then I could only determine after my servlet is first called, right?
  Anyway, how I would do that? Getting all bytes from the string from
the beginning 'till the end or '?' character?

On Fri, 2003-02-07 at 17:20, Erik Price wrote:
> 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 
> context-parameter.
> >   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).
> Erik
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Felipe Schnack
Analista de Sistemas
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
Fone/Fax.: (51)32303341

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

View raw message