On Sun, 3 Nov 2002, Pae Choi wrote:

> Date: Sun, 3 Nov 2002 13:28:57 -0800
> From: Pae Choi <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [TC v4.1.12] Anything abnormal in the Context Path
>
> Have you tried the following?
>
> ServletContext sctx = getServletContext();
> String contextBugPath = sctx.getRealPath(reqRef.getContextPath());

This is not likely to give you anything useful -- the path you pass to the
getRealPath() method is supposed to be context relative, not server
relative.  If you want the absolute path to the top-level directory of
your webapp, for example, you'd really want to try:

  String contextAbsolutePath = sctx.getRealPath("/");

Of course, this only works on servlet containers that run webapps from
unpacked directories (like Tomcat can), so you can't rely on it being
portable.  For example, any container that runs your webapp directly from
a WAR file will return null on the above call.

>
> What do you get? Anything abnormal?
>
>
> Pae
>
>

Craig



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to