开发者

Google App Engine (Java) - Get URL to static file

开发者 https://www.devze.com 2023-02-04 20:28 出处:网络
I have a static XML file called rules.xml in 开发者_Python百科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 Read

I have a static XML file called rules.xml in 开发者_Python百科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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消