Accessing a file (for writing) from a JBoss Web Service
Posted
by Andreas Grech
on Stack Overflow
See other posts from Stack Overflow
or by Andreas Grech
Published on 2010-05-09T13:19:40Z
Indexed on
2010/05/09
13:28 UTC
Read the original article
Hit count: 183
Let's say I have this structure of my Java Web Application:
TheProject
-- [Web Pages]
-- -- abc.txt
-- -- index.jsp
-- [Source Packages]
-- -- [wservices]
-- -- -- WS.java
WS.java
is my Web Service, which is situated in a wservices
package. Now from this service, I need to access the abc.txt
file and write to it.
These are my urls:
http://127.0.0.1:8080/TheProject/WS <- the webservice
http://127.0.0.1:8080/TheProject/abc.txt <- the file I want to access
To read the file, I tried with getResourceAsStream
and I was successful in reading from it. But now I also want to write to this file, and I tried such a method but failed.
Is there a way I can get access to the abc.txt
file from WS.java
and be able to successfully read from and write to it?
© Stack Overflow or respective owner