tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Bromley <martin.brom...@sustainable-energy.co.uk>
Subject getServletContext() returns "/" for default context defined outside of server.xml
Date Fri, 22 Jul 2005 11:16:03 GMT
Hi, I'm trying to setup the default Context for a Host, without defining it in server.xml.

In conf/Catalina/localhost I've created a file named .xml, and defined the Context within
it, without defining the path - I understand from the Tomcat docs that it should be inferred
as "".

This is all working fine, apart from one issue:  a call to HttpServletRequest.getServletContext()
returns "/" rather than "" - the servlet API says "" is correct .  If the default context
is defined in server.xml, getServletContext() returns "" as it should.

I'm guessing that this might be a bug, but I'm reluctant to say so because I suspect I might
be doing something wrong - the Tomcat docs do say "it is not recommended to place <Context>
elements directly in the server.xml file", but then creating a .xml file seems a little odd
to me...  Is that really the right way to do it?

I've tested this on Tomcat 5.5.4 and 5.5.7.

Cheers
Martin


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