tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anto Paul <antop...@gmail.com>
Subject Re: Directory Creation in Servlet Question
Date Mon, 09 May 2005 11:39:26 GMT
On 5/6/05, Joe Hertz <jhertz@speakeasy.net> wrote:
> In Windows that's what it means too, but this isn't Windows or Linux...it's
> a JVM.
> 
> Since it wasn't obvious from the code (MessageResources used in pathnames),
> let me put it another way.
> 
> The code tries to create a directory /images/<userid>.
> 
> The Servlet is apparently limited in the filepath it gets to work with. I'd
> expect that.
> 
> In Windows, Tomcat executes it and it goes to C:\tomcat4\images\<userid>
> 
> In my Suze install, Tomcat the analogous directory
> /opt/tomcat4/webapps/images
> 
> I didn't check to see if it's *different* because in the code it won't be.
> It's the same identifier working off of root. Windows Tomcat puts it under
> it's webapps tree. I'm expecting Suze to do the same.
> 
> I have a hard time imagining that Tomcat gets a different view of its root
> file system depending on which OS I runs on. It really ruins the concept of
> platform independence for this sort of thing.
> 
> -Joe
> 
> > you tried to debug it. You can check what is the path before
> > the directory is created. In Linux / means the root directory
> > and since the path name begins with File.separator(/), the
> > file is created with reference to /. For eg. if filePath is
> > /anto. Then if Tomcat have write permission to root directory
> > the directory will be created.
> >
> > --
> > rgds
> > Anto Paul
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

    You should read the API spec of java.io.File.
http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

    If you want to get the absolute path of the application directory
use ServletContext.getRealPath("/"); and pass this to the file
creating code.

-- 
rgds
Anto Paul

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


Mime
View raw message