On Thu, 12 Dec 2002, Sridhar Devulkar wrote:

> Date: Thu, 12 Dec 2002 11:31:42 -0800
> From: Sridhar Devulkar <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: 'Tomcat Users List' <[EMAIL PROTECTED]>
> Subject: RE: Accessing the Context tag attributes of server.xml ...
>
> Hello Shapira,
>
> Thanks very much for the reply.
>
> Well, as you say, the context path cannot be retrieved without issuing a
> servelt request, is it?
>
> I too understand your point of hacking into server.xml.  So, I am dropped
> this idea.
>
> I am totally dependent on the context path to be able to initialize my
> datastore library, there by having a fully qualified url in the
> initialization phase.  I guess, I have to change my code and build my url
> whenever there is a request for getting data from the datastore.
>

There actually is a reason that the context path is not available in the
init() method of a servlet.  Even though it is unusual, it's legal to have
the same servlet instances being processed in more than one webapp, and
therefore on more than one context path.

Therefore, if you need to do initialization based on the context path,
you're going to be stuck waiting for the first request.  I've seen some
people in this situation modify their startup scripts to immediately send
some sort of "ping" request to their application to trigger this kind of
initialization, immediately after the server comes up, to ensure that the
first user doesn't have to wait.

> Sridhar.

Craig


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

Reply via email to