Creating a feed in mem instead of on disk

Brian Pipa
  • Brian Pipa

    Brian Pipa - 2005-08-12

    Hi all,

    I am trying to add RSS feeds to a JSP site. I want to create the feed in memory and return the feed via a JSP without ever writing the feed to disk. Looking at the exporters, I didn't see a way to do this - it looks like they only write to disk. It looks like they *almost* have this ability since they can take a Writer (and thus a StringWriter), but there is no way to get the String back. Is there a way to do this in the current API?

    Assuming there was no way to do it in the API, I made some changes to the API so you could get the String representation of a feed without writing it to disk. I'd like to contribute this code back to the project if anyone thinks this may be useful, but I'm not sure how to contribute the code. The changes add 3 new small classes, 1 new interface, and a small change to each of the three current exporters.


    • Brian Pipa

      Brian Pipa - 2005-08-12

      To answer my own post, I got the answer from the mailing list thanks to Doug Matthews - here it is:


      No, you don't need to write the output to disk.

      If you're writing a servlet or jsp page you have access to a "response"
      object of type HttpServletResponse, which can return you a reference to
      a PrintWriter, where you can write your response directly to the output

      See this example

                     try {
                             writer = response.getWriter();

                             // buildChannel is my method to return a channel
                             ChannelIF channel = buildChannel();

                             ChannelExporterIF exporter = new


                     } catch ( e) {
                             // TODO log it in with some WARN or ERROR level;


      You can also get the string representation by just passing a
      StringWriter to the exporter and then calling the writer's toString


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks