tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milt Epstein <mepst...@uiuc.edu>
Subject Re: SOLVED: How to get the context path for a web application?
Date Tue, 10 Aug 2004 17:53:06 GMT
On Tue, 10 Aug 2004, David Wall wrote:

> > No, and an archive search would reveal past discussions around this
> > issue (though none recently).   Webapps are supposed to be independent
> > of their server configuration including with regards to context path,
> > and so the Servlet Spec actively discourages you from doing webapp
> > initialization or configuration based on such data.  A lot of people
> > debated for a long time what does and doesn't go into the
> > ServletContext/ServletConfig objects as opposed to Request/Response
> > objects.
>
> 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.

You could always pass it in yourself as a context variable (i.e.,
context init-param).  The problems then are that you're duplicating
data and reducing portability.

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu

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