tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Howto read files
Date Mon, 04 Oct 2004 13:38:06 GMT

Hi,
Use ServletContext#getResource(AsStream) or Class#getResource(AsStream),
as described in the Tomcat FAQ.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: dmu2201 [mailto:dmu2201@mail.ikasths.dk]
>Sent: Monday, October 04, 2004 9:34 AM
>To: tomcat-user@jakarta.apache.org
>Subject: Howto read files
>
>Hi ML....
>
>I'm having a problem with tomcat because I would like to read a certain
>XML file in a 'data' dir. The problem is that the relative path does
not
>work:
>  new File("data/questionnaires.xml/");
>does not give the file since Tomcat is started from its bin dir and not
>from my /webapps/PROJECT dir.
>
>How do I, in a "nice" manner access that file with, hopefully, a
>relative path. I need a relative path or some kind of 'property' that
>enables me to access the file, independent of operating system.
>
>I have tried to use a <Context path="/PROJECT" docBase="PROJECT" |
>docBase="webapps/PROJECT" /> in a context.xml file in a META-INF dir,
>but no luck :-(
>
>My dir structure:
>/webapps
>--/PROJECT
>--/data  <---The dir I want to access
>--/WEB-INF/
>--/WEB-INF/src
>--/WEB-INF/classes
>--/displayQuestionnaires/
>----/*.jsp
>
>Hope someone can help...
>
>Claus
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
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