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:[EMAIL PROTECTED]]
>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:[EMAIL PROTECTED]]
>> 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
>> [EMAIL PROTECTED]
>>
>>
>>>-----Original Message-----
>>>From: Shapira, Yoav [mailto:[EMAIL PROTECTED]]
>>>Sent: Tuesday, June 25, 2002 9:20 AM
>>>To: [EMAIL PROTECTED]
>>>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-
>[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:tomcat-user-
>[EMAIL PROTECTED]>


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

Reply via email to