I'm never sure why smart people get this confused.
 
ContextPath... has nothing whatsoever to do with  running in a WAR, from a
database, or exploded from a file system.

For simple little things that an application might want to do like, oh, I
don't know... reminder emails that might contain a link to the webapp in
question.  At that point, there is no request, since this is probably a
scheduled occurrence. I suppose rather than use a scheduler, I could use
cron and wget to hit a URL, in which case, voila, I'd have a
HttpServletRequest. But wouldn't it be great if you could do
application.getContextPath()?  
 
But alas, the expert group feels the answer is 'no'. Fine, whatever.

It seems ridiculous that the application should not know anything about "who
it is", or "under what URL/I I'm running" or "however you want to think of
it", until an HttpRequest arrives on the scene. 

I just couldn't let it pass without pointing out that the one (contextPath)
has nothing to do with the reasons that are normally cited for its exclusion
from anything but HttpServletRequest.


> -----Original Message-----
> From: Ben Souther [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 13, 2004 9:12 AM
> To: Tomcat Users List
> Subject: Re: SOLVED: How to get the context path for a web 
> application?
> 
> 
> Per the servlet spec, a j2ee app isn't required to have an 
> app path. The entire war file can be deployed remotely and 
> run without ever being 
> unpacked. In a case like that, there would be no path to the 
> application.
> 


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

Reply via email to