Thanks for the quick answwer but getRealPath()
is not what I 'm looking for. getRealPath() would
give me, for example, "c:\data\...\..."
Suppose I have the class TestServlet, that is
called with http://www.mydomain.com/myapp/servlet/TestServlet
Inside doGet() I want to return an html page
with a link to a gif that 's located in
http://www.mydomain.com/myapp/img/test.jpg".
If I use relative paths, I can use "../img/test.jpg",
but if I want to use absolute paths (what I want),
I must send to the client "/myapp/img/test.jpg".
Instead of "/myapp/" directly in code, I want
to do it dynamically, so tomorrow I can map
the application to an other point and don 't
break it.
I found getServletContextName() in spec 2.3 but
nothing in 2.2.
Any ideas ?
-----Original Message-----
From: PUB: Lindsay, William (USPC.PCT.Hopewell)
[mailto:[EMAIL PROTECTED]]
Sent: Mi�rcoles, 29 de Agosto de 2001 04:04 p.m.
To: [EMAIL PROTECTED]
Subject: Re: WebApp mapping
I believe this what you are looking for.
System.out.println(getServletContext().getRealPath("http://www.mydomain.com/
myapp"));
-----Original Message-----
From: ARPON Mart�n DST [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 2:46 PM
To: [EMAIL PROTECTED]
Subject: WebApp mapping
Hi, how can I know what path is my webapp
mapped to ?
I mean, if I use http://www.mydomain.com/myapp
to access the application, where how can I
obtain in servlet code the "myapp" value ?
Thanks,
Martin
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html