I have the following structure in a Java web application:
TheProject -- [Web Pages] -- -- [WEB-INF] -- -- -- abc.txt -- -- index.jsp -- [Source Packages] -- -- [wservices] -- -- -- WS.java
In WS.java , I use the following code in a web method:
InputStream fstream = this.getClass().getResourceAsStream("abc.txt");
But it always returns zero. I need to read from this file, and I read that if you put the files in WEB-INF , you can access them using getResourceAsStream , but the method always returns null .
Any ideas on what I might be doing wrong?
By the way, it is strange that this worked, but after I performed Clean and Build in the project, it suddenly stopped working: /
java inputstream web-services jboss
Andreas Grech May 09 '10 at 9:18 a.m. 2010-05-09 09:18
source share