If you're trying from inside a servlet or so, the 
getResourceAsStream works fine, as the path pass something like
/WEB-INF/somedir/somefile.someextension.
Try not to use getRealPath.
See list's messages explaining the use of properties files.

If you want to access a directory below WEB-INF from client 
side, Tomcat won't normally do. Everything inside WEB-INF is 
protected from client access. But I could imagine you could 
develop a servlet, which serves these resource if necessary. But 
you should rather not do this.

Andreas

On 29 Nov 2002 at 4:17, Peter Lee wrote:

> On 29 Nov 2002 at 11:03, Andreas Probst wrote:
> 
> I can now access the folder directly above the WEB-INF folder.
> Actually, I meant  a folder which is  directly below  the WEB-INF
> folder. This is still causing problems.
> 
> Thanks
> 
> > Hello Peter,
> > 
> > did you try 
> > public java.lang.String getRealPath(java.lang.String path) of
> > javax.servlet.ServletContext?
> > 
> > or preferrably
> > public java.net.URL getResource(java.lang.String path)
> > or public java.io.InputStream 
> > getResourceAsStream(java.lang.String path)
> > 
> > Which directory do you mean, your webapp's directory, which is
> > directly above WEB-INF or do you mean even higher above?
> > 
> > The getResourceAsStream works fine for resources inside your
> > webapp and should be used instead of getRealPath.
> > 
> > Hope this helps.
> > 
> > Andreas
> > 
> > 
> > On 29 Nov 2002 at 1:18, Peter Lee wrote:
> > 
> > > I am using Tomcat for servlets. 
> > > How  do I get the absolute path of a file in a directory
> > > above WEB-INF directory of my web application?
> > > 
> > > Thanks
> > > 
> > > 
> > >
> 
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to