tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Everman <ever...@precedadesign.com>
Subject RE: Servlet knowing its own URL
Date Tue, 25 Jun 2002 17:49:43 GMT
As a follow up, what is the path of a servlet mapped to:

/somepath/*

There is an UNLIMITED number of URLS that can access this servlet - which 
one do you want?  The information you want is dynamic - you can't expect a 
static answer.  Perhaps if you post your question in more context - ie what 
is it you are trying to do with the URL information?

Cheers,

Eric Everman



At 11:54 AM 6/25/2002, you wrote:
>Howdy,
>Thanks for the responses.  Unfortunately that's what I thought I'd hear
>;(  Oh well, so much for that idea ;)
>
>Yoav Shapira
>Millennium ChemInformatics
>
>
> >-----Original Message-----
> >From: Tim Funk [mailto:funkman@joedog.org]
> >Sent: Tuesday, June 25, 2002 12:50 PM
> >To: Tomcat Users List
> >Subject: Re: Servlet knowing its own URL
> >
> >A servlet can't know its URL at startup - because a servlet is mapped
>to
> >a URL pattern. It is only at request time a servlet can know its URL
> >using the methods in the HttpServletRequest object. But even these
> >values can be misleading if the servlet is included and not explicitly
> >requested.
> >
> >-Tim
> >
> >Dan Diodati wrote:
> >> I believe you have to access the HttpServletRequest object(
> >> getContextPath(), etc ). The getServletName() just returns then
>webapp
> >name
> >> set in the web.xml file.
> >>
> >>
> >> -----Original Message-----
> >> From: Mike Jackson [mailto:mjackson@cdi-hq.com]
> >> Sent: Tuesday, June 25, 2002 9:33 AM
> >> To: Tomcat Users List
> >> Subject: RE: Servlet knowing its own URL
> >>
> >>
> >> You can get the name from getServletName, I think the rest of what
> >> you're looking for can be acquired from the servlet context, but
> >> I might be wrong.
> >>
> >> --mikej
> >> -=-----
> >> mike jackson
> >> mjackson@cdi-hq.com
> >>
> >>
> >>>-----Original Message-----
> >>>From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
> >>>Sent: Tuesday, June 25, 2002 9:20 AM
> >>>To: tomcat-user@jakarta.apache.org
> >>>Subject: Servlet knowing its own URL
> >>>
> >>>
> >>>Howdy,
> >>>I'm probably missing something basic here ;)  But how can a Servlet
>know
> >>>its own URL at startup, before any requests are sent to it?
> >>>
> >>>More specifically, if I have a webapp MyApp, and a servlet MyServlet,
> >>>accessible as
> >>>http://myhost.mydomain:myport/MyApp/MyServlet
> >>>
> >>>I would like MyServlet's init() method to figure out that its context
>is
> >>>at
> >>>http://myhost.mydomain:myport/MyApp
> >>>
> >>>Any ideas, suggestions etc. much appreciated ;)
> >>>
> >>>Yoav Shapira
> >>>Millennium ChemInformatics
> >>>
> >
> >
> >--
> >To unsubscribe, 
> e-mail:   <mailto:tomcat-user->unsubscribe@jakarta.apache.org>
> >For additional commands, e-mail: 
> <mailto:tomcat-user->help@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message