How can I get my web app to read my flat file located in myapp\web-inf directory. Any suggestions would be appreciated.
- Posted by: Whyte Peter
- Posted on: May 17 2003 14:04 EDT
- Problems with reading from flat file by SAF . on May 17 2003 16:13 EDT
URL url = new URL("http://myApp:80/file.txt);
BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream()));
String line = "";
StringBuffer buffer = new StringBuffer();
while( (line = reader.readLine()) != null)
I almost forgot, don't place the file under WEB-INF, place it under the document root, or any subfolder under the document root directory. I don't think you can read files under WEB-INF since they are protected.
SAF, you are right. Files under WEB-INF are protected.
maybe try to get the root context path of the web application then add WEB-INF to the path and pass to a file object