tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: SOLVED: How to get the context path for a web application?
Date Tue, 10 Aug 2004 17:57:40 GMT

Hi,

>True and it's mostly not a big issue.  However, is it possible for a
>ServletContext to reference one context path and the Request objects to
>have
>a different one?  Most webapps only operate under a single context path
>(don't they?), so having it at initialization would be nice too.  Oh
>well...
>With the path, I could build URLs for email and other logging info at
>initialization that cannot be done dynamically without knowing the
>host/port/contextpath.

All webapps operate under one context path: that's a one to one
relationship at the core of the Servlet Specification.

Note that one reason the ServletContext object does have a context path
is that the latter is an HTTP-specific concept.  (One has to be very
careful here as these terms are used interchangeably).  The
ServletContext and ServletConfig objects are explicitly
protocol-independent.  Specifically, what the ServletContext JavaDoc
calls "uripath" may or may not correspond to a path on the hard-drive
and in the Request#getContextPath method.

There's more to this but I have to run to a meeting ;)

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
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