On Thu, 1 Mar 2001, Brett G. Palmer wrote:

> What is the best way to read a file from a Context in Tomcat?  I know I can
> get the context path from the "getContextPath()" method, but most file
> stream APIs require a full path.  There most be a clean way to accomplish
> this without hard coding any directory path info.

I've used the following in the past, where s is a ServletConfig object

        ServletContext sc = s.getServletContext();
        String fullPath = sc.getRealPath("") + "WEB-INF/myfiles/xyz.dat"

Kevin Sangeelee
Software Developer
Corpfin Ltd



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to