well, you stumped me.
I looked at the API and it said this:
"Some containers may allow writing to the URL returned by this method
using the methods of the URL class."
So I'm hoping someone else can answer this about tomcat.
----------
So if you cannot use the URL accessors, as the API states. Then the next
best this would be:
new File( getServletContext().getRealPath( filereltoroot ) );
fern
On Tue, 20 Feb 2001, Dominique BATARD wrote:
>
> ServletContext.getResourceAsStream() is perfect for reading a file. But what
> about writing a file ?
>
> Dom
>
>
> ----- Original Message -----
> From: "Fernando Padilla" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "Jonathan Asbell" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 20, 2001 4:34 PM
> Subject: Re: *** Referring to a file or a directory from inside a
> jsp/servlet or bean ???? ***
>
>
> >
> >
> > It all depends on what your code is. I'm assuming you're just using new
> > File( relpath ), which should be relative to the user.dir system property,
> > which should be Tomcat bin I suppose ( this is all educated guessing i
> > tell you. ).
> >
> > Does knowing that help you? Your relative path should then be
> > "../webapps/myapp/etc".
> >
> >
> > Instead of getting to a file as such, you really should be using some of
> > the file/resource accessors from ServletContext, so that it will be
> > relative to the context root so that it's portable.. Look at
> > ServletContext.getResource() and ServletContext.getResourceAsStream().
> >
> > fern
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]