I believe that the original servlet spec allowed direct access to root of the web site, but these methods were deprecated for security reasons. I have been having this problem myself, what a wonderful solution!
 
Regards,
 
The Elephantwalker
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Johan Fredriksson
Sent: Wednesday, April 11, 2001 9:50 AM
To: Orion-Interest
Subject: Re: Application mapping - how do I know it from within the app?

okey, I fígured it out... With a little help.
 
I hope this function will appear in servlet 2.3 version ( and why isn't orion running 2.3?? )
 
anyways, if anyone else runs into this copy paste this line :
 
String servletPath = request.getRequestURI().substring(0, request.getRequestURI().indexOf(request.getServletPath()));
 
Which will return the mapping to the root of your application.
 
 
Johan
 
 
----- Original Message -----
Sent: Wednesday, April 11, 2001 4:59 PM
Subject: Application mapping - how do I know it from within the app?

I'm using virtual hosts in my development to make sure that all links are correctly set, that is I can access the same app in two ways, either via
 
appname.localhost
 
or
 
localhost/appname
 
.
 
The problem is that I'm not sure how to figure out on a jsp page which entry point was used, and this causes problem when I'm trying to map my servlet, since relative paths to servlets does not seem to work...
 
String parsing of request.getRequestURI() seems like a way to start, but I'm not sure what how to write it, since in the future the app might be moved again to
 
appname.serviceprovider.localhost
 
vs
 
localhost/serviceprovider/appname
 
.
 
Is there a way to get pageContext return application context?
 
 
 
Johan

Reply via email to