tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Harper" <rob...@iat-cti.com>
Subject RE: SOLVED: How to get the context path for a web application?
Date Tue, 10 Aug 2004 17:57:26 GMT
If you set your container to start a pool of servlets when it starts, the init
should be called then. I'm not sure how to set Tomcat to start up a pool of
"Keep alive" servlets. You'll have to consult the docs for that. The init is
called when the servlet is instantiated and should be called before requests are
made if the servlet is started before request arrive. I have done this with
other servlet containers.

Robert S. Harper
801.265.8800 ex. 255

> -----Original Message-----
> From: David Wall [mailto:d.wall@computer.org]
> Sent: Tuesday, August 10, 2004 11:27 AM
> To: Tomcat Users List
> Subject: Re: SOLVED: How to get the context path for a web application?
> 
> > Someone on the list suggested Request.getContextPath() and it works like a
> > charm. Thanks to all.
> 
> Agreed, but my follow-up question was if there was such a call to be done
> using a ServletContext/ServletConfig object so that you can get the context
> path in initialization servlets, etc., before a request comes in.
> 
> David
> 
> 
> > >> A ServletConfig reference is passed in the call to the init() method of
> > > your
> > >> servlet. From this you may use the getServletContext() method to get
> the
> > >> context. One thing to remember is that this does not get called until
> the
> > >> servlet is initialized and would be invalidated when it is destroyed. I
> > > suggest
> > >> you check the API docs for more information.
> > >
> > > But do any of those return the context path?  I didn't see it anywhere
> in
> > > the javadocs.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 




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


Mime
View raw message