tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Access XML file inside the Java File
Date Wed, 04 Aug 2010 13:45:29 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chandra,

On 8/4/2010 6:28 AM, Chandana Napagoda wrote:
> I have Domain class it need to read file and need to return File object.
> When I'm getting my file object. My domain class always try to access in Bin
> ("D:\Share\apache-tomcat-6.0.20\bin\connections.xml")

Maybe you have the path wrong. Maybe not. What does your code look like?

That's kind of rhetorical, since I know it looks like this:

InputStream in = new FileInputStream("connections.xml");
...

...but post your code, anyway.

> It it possible to access read file inside the War file?

Yes. Use the Servlet API to get access to your webapp's resources
instead of trying to read the disk directly. Hint: look at methods in
the ServletContext class.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxZbvgACgkQ9CaO5/Lv0PAWcACgt9NBV9Y4Ljhc7HLDyyHJ6ksX
xJ8AoLjWH1T02loHtAAW0zOyrwKzPGp2
=ssJ1
-----END PGP SIGNATURE-----

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


Mime
View raw message