Re: Application base URL
- From: Babu Kalakrishnan <bkk.ngroup@xxxxxxxxx>
- Date: Tue, 29 Aug 2006 17:58:49 +0530
Andrew Thompson wrote:
zakmck73@xxxxxxxx wrote:
..
Now, how may I know what exactly is "http://some.host.net:port/myApp/"
from whitin a JSP or a servlet?
<http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)>
That would give you only the RealPath relative to the local file system. (On my local server, it would return "/opt/tomcat55/webapps/myApp/xxx" )
The original question cannot really be answered in a global context. For instance, the same resource may be available under several variants of the URL. e.g. A certain page that may be accessible as "http://127.0.0.1:8080/myApp/index.jsp" from my local machine would only be accessible with a different hostname/IP when the same is accessed from another machine on the internet.
This information therefore would be relevant only in the context of a particular HTTP request, and one can obtain it using :
request.getRequestURL();
BK
.
- Follow-Ups:
- Re: Application base URL
- From: ElectricHappiness.com
- Re: Application base URL
- References:
- Application base URL
- From: zakmck73
- Re: Application base URL
- From: Andrew Thompson
- Application base URL
- Prev by Date: Re: java.lang.NoClassDefFoundError
- Next by Date: Re: Vector efficiency
- Previous by thread: Re: Application base URL
- Next by thread: Re: Application base URL
- Index(es):