GeoRss Rome Home

GeoRSS Servlet Producer Code Example

    public void doGet(HttpServletRequest req, HttpServletResponse res)
            throws ServletException, IOException {
        res.setContentType("application/xml; charset="
                + Constants.CHAR_ENCODING);
        SyndFeed feed = new SyndFeedImpl();
        feed.setFeedType("rss_2.0");

        feed.setTitle("Sample Feed (created with ROME)");
        feed.setLink("http://rome.dev.java.net");
        feed.setDescription("This feed has been created using ROME");

        List entries = new ArrayList();
        SyndEntry entry;
        SyndContent description;

        entry = new SyndEntryImpl();
        entry.setTitle("ROME v1.0");
        entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
        entry.setPublishedDate(new Date());
        description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue("Initial release of ROME");
        entry.setDescription(description);
        entries.add(entry);

        GeoRSSModule geoRSSModule = new SimpleModuleImpl();
        geoRSSModule.setPosition(new Position(54.2, 12.4));
        entry.getModules().add(geoRSSModule);

        feed.setEntries(entries);

        SyndFeedOutput output = new SyndFeedOutput();
        try {
            output.output(feed, res.getWriter());
        } catch (FeedException ex) {
            // exception handling ...
        }
    }

Drop the files georss-rome-0.8.2.jar, rome-0.8.jar and jdom-1.0.jar into the WEB-INF/lib directory of your webapplication.

back to GeoRss Rome Home