0

I have a static XML file called rules.xml in war/xml/. It is a rules file for the Apache Commons Digester. In order to be able to use the file I need to be able to open it with a Reader. How can I open the file?

tshepang
  • 12,111
  • 21
  • 91
  • 136
  • 1
    possible duplicate of [File path to resource in our war/WEB-INF folder?](http://stackoverflow.com/questions/4340653/file-path-to-resource-in-our-war-web-inf-folder) – Amber Jan 12 '11 at 17:51

1 Answers1

2

try using

final String file = "xml/rules.xml";

FileReader fileReader;
try
{
   fileReader = new FileReader(file);
   ...
}
catch(..)

edit: after some intensive usage, FileReader in GAE seems have some trouble with accentuated characters (Only visible on GAE cloud instances, local tests runs perfectly). If someone encounters this kind of bugs, use FileInputStream instead. It worked for me. Check this page for more informations : http://code.google.com/intl/en/appengine/kb/java.html#readfile

Cheers.

PSantos
  • 46
  • 4