I’m using an XMLStreamWriter to write XML to an RSS file that is located in the WebContent directory.
XMLStreamWriter writer = factory.createXMLStreamWriter(new FileWriter("\\XRSSserverlet\\StatusRSS.rss")
I’m getting a FileNotFound Exception.
What is the best way to write to this file–or any file located in the WeContent Folder. I’m linking to this file from another page that is handled by a servlet as my RSS link.
Thanks.
Full exception: Sever: java.io.FileNoteFoundException: \XRSSservlet\StatusRSS.rss (The system cannot find the path specified)
So I think there is a standard way to reference this folder or I need to add something to a build path somewhere.
Edit: I should add that the calling ejb is in a separate EJB project than the webcontent folder which is in Dynamic Web Project. They are all in the same EAR project though and the build paths are set up correctly.
RSS feed is not static resource I would generate this feed dynamically in servlet as response instead. Even your file path suggests it should be a servlet. Also you could add some caching etc. Just output your XML into response stream and add proper headers.