tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Incze Lajos <in...@mail.matav.hu>
Subject Re: AJP Todo
Date Mon, 10 Dec 2001 16:02:37 GMT
On Sun, Dec 09, 2001 at 08:24:35PM -0800, Bill Barker wrote:
...
> (b) For a context defined in the server.xml, there seems to be no public way
> to determine the document base as an absolute path.  This may just be my
> lack of familiarity with Catalina however.  On a related note, I wasn't able
> to find any way to determine if a Context even has a document base (as
> opposed to a war file).
> 
What's wrong with this? (ServletContext method javadoc both 2.2 and 2.3)
----
getRealPath

public java.lang.String getRealPath(java.lang.String path)

Returns a String containing the real path for a given virtual path.
For example, the path "/index.html" returns the absolute file path
on the server's filesystem would be served by a request for
"http://host/contextPath/index.html", where contextPath is the context
path of this ServletContext..

The real path returned will be in a form appropriate to the computer and
operating system on which the servlet container is running, including the
proper path separators. This method returns null if the servlet container
cannot translate the virtual path to a real path for any reason (such as
when the content is being made available from a .war archive).
-----
So, getServletContext().getRealPath( "/" )

incze

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


Mime
View raw message