You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Patrick Kosiol <ko...@simu.de> on 2002/12/09 12:34:30 UTC

How to get a "File" for a certain folder

Hi,

how can I get a File-Object for a certain Folder placed under my 
$CATALINA_HOME/webapps/ROOT/ - Folder. I want to traverse over the files 
that are placed there.
Can anyone help me?

thx
Patrick


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get a "File" for a certain folder

Posted by Patrick Kosiol <ko...@simu.de>.
Hi,

the needed class isn't my Problem. It is that I have the relative 
tomcat-path and want to open a folder. But that doesn't work. I can't 
access these folder or also a file, that is my problem. Can you help me?

Patrick

micael wrote:

> You just want some functionality in a class.  Where you use it is not 
> immediately important.  Just use it in a servlet.  If you don't know 
> how to use servlets, that is a separate problem.  Check out Hunter and 
> Crawford on servlets.
>
> At 12:37 PM 12/9/2002 +0100, you wrote:
>
>
>> Patrick Kosiol wrote:
>>
>>> Hi,
>>>
>>> how can I get a File-Object for a certain Folder placed under my 
>>> $CATALINA_HOME/webapps/ROOT/ - Folder. I want to traverse over the 
>>> files that are placed there.
>>> Can anyone help me?
>>>
>>> thx
>>> Patrick
>>>
>>>
>>> -- 
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail: 
>>> <ma...@jakarta.apache.org>
>>
>>
>> I have forgot to say that I want to do this trought out of a Servlet 
>> that is placed under 
>> $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/myapp...".
>>
>>
>>
>> -- 
>> To unsubscribe, e-mail:   
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail: 
>> <ma...@jakarta.apache.org>
>>
>
> Micael
>
> -------------------------------------------------------
>
> This electronic mail  transmission and any accompanying documents 
> contain information belonging to the sender which may be confidential 
> and legally privileged.  This information is intended only for the use 
> of the individual or entity to whom this electronic mail transmission 
> was sent as indicated above. If you are not the intended recipient, 
> any disclosure, copying, distribution, or action taken in reliance on 
> the contents of the information contained in this transmission is 
> strictly prohibited.  If you have received this transmission in error, 
> please delete the message.  Thank you 
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get a "File" for a certain folder

Posted by micael <ca...@harbornet.com>.
You just want some functionality in a class.  Where you use it is not 
immediately important.  Just use it in a servlet.  If you don't know how to 
use servlets, that is a separate problem.  Check out Hunter and Crawford on 
servlets.

At 12:37 PM 12/9/2002 +0100, you wrote:


>Patrick Kosiol wrote:
>
>>Hi,
>>
>>how can I get a File-Object for a certain Folder placed under my 
>>$CATALINA_HOME/webapps/ROOT/ - Folder. I want to traverse over the files 
>>that are placed there.
>>Can anyone help me?
>>
>>thx
>>Patrick
>>
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>I have forgot to say that I want to do this trought out of a Servlet that 
>is placed under $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/myapp...".
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>

Micael

-------------------------------------------------------

This electronic mail  transmission and any accompanying documents contain 
information belonging to the sender which may be confidential and legally 
privileged.  This information is intended only for the use of the 
individual or entity to whom this electronic mail transmission was sent as 
indicated above. If you are not the intended recipient, any disclosure, 
copying, distribution, or action taken in reliance on the contents of the 
information contained in this transmission is strictly prohibited.  If you 
have received this transmission in error, please delete the message.  Thank 
you  



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


How to get a "File" for a certain folder

Posted by Patrick Kosiol <ko...@simu.de>.

Patrick Kosiol wrote:

> Hi,
>
> how can I get a File-Object for a certain Folder placed under my 
> $CATALINA_HOME/webapps/ROOT/ - Folder. I want to traverse over the 
> files that are placed there.
> Can anyone help me?
>
> thx
> Patrick
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>

I have forgot to say that I want to do this trought out of a Servlet 
that is placed under $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/myapp...".



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get a "File" for a certain folder

Posted by micael <ca...@harbornet.com>.
I can tell you, but I think you will misunderstand.  File certainFolder = 
new File("[folder file url]");  You need to read a Java book on 
files.  There are lots of good ones.  You can actually just read the 
interface, JavaDocs, for File and pretty much get the answer.  Most Java 
books include something on files.  Go to www.java.sun.com and read a 
tutorial.  Then you can "traverse" away.  The answers are all in the File 
class, if you know Java sufficiently to be able to read a JavaDoc.

At 12:34 PM 12/9/2002 +0100, you wrote:
>Hi,
>
>how can I get a File-Object for a certain Folder placed under my 
>$CATALINA_HOME/webapps/ROOT/ - Folder. I want to traverse over the files 
>that are placed there.
>Can anyone help me?
>
>thx
>Patrick
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>

Micael

-------------------------------------------------------

This electronic mail  transmission and any accompanying documents contain 
information belonging to the sender which may be confidential and legally 
privileged.  This information is intended only for the use of the 
individual or entity to whom this electronic mail transmission was sent as 
indicated above. If you are not the intended recipient, any disclosure, 
copying, distribution, or action taken in reliance on the contents of the 
information contained in this transmission is strictly prohibited.  If you 
have received this transmission in error, please delete the message.  Thank 
you  



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get a "File" for a certain folder

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 9 Dec 2002, Patrick Kosiol wrote:

> Date: Mon, 09 Dec 2002 12:34:30 +0100
> From: Patrick Kosiol <ko...@simu.de>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: How to get a "File" for a certain folder
>
> Hi,
>
> how can I get a File-Object for a certain Folder placed under my
> $CATALINA_HOME/webapps/ROOT/ - Folder. I want to traverse over the files
> that are placed there.
> Can anyone help me?
>

There is no guarantee that there is such a thing as a folder for your
webapps -- it's entirely legal for servlet containers to run your app
directly from a WAR file.

For maximum portability, you should use the
ServletContext.getResourcePaths() method to give you the names of the
resources in a particular "directory" of your webapp -- this will work
whether or not the container actually runs your app from an unpacked
directory.

> thx
> Patrick

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>