Ben Jessel wrote:
> I have a web application that is contained in a war file. I have a
> requirement to generate an xml file ( will be an rss field ), that can
> be accessible at a given url within my web application. This file
> could be quite big, so I can't just generate it on the fly per
> request. Nor can I cache it in session data.
> I'd prefer to deploy my application in war, rather than exploded-war
> format ( portability being a large concern.... ), however given I need
> to generate this xml file and save it in a directory of my web-app
> root, I think my only option is to revert to exploded war use.
> Is there any way of programatically creating/updating a file within
> say, the my-app war from a servlet in the war itself?
> My alternative strategies are
> 1) saving the xml to the database ( something that the purist in me
> hates the idea of ).
> 2) pushing the file to another server.
(3) Generate it at application startup or on the first request, and
store it in the temp directory provided to you by the servlet container.
Create a servlet, mapped to the designated URL, that delivers the data.
That is completely independant of deployment format, does not depend on
another server, and should be as efficient as you can hope for given