public final class RssMethods extends Object
Contains one-liners for RSS-related operations.
Constructor and Description |
---|
RssMethods(io.toro.martini.rss.SyndFeedClient syndFeedClient) |
Modifier and Type | Method and Description |
---|---|
static io.toro.gloop.object.property.GloopModel |
readRss(String url)
Read and return an RSS feed from a URL.
|
static io.toro.gloop.object.property.GloopModel |
readRss(String url,
boolean onlyNew)
Read and return an RSS feed from a URL.
|
static com.rometools.rome.feed.synd.SyndFeed |
rss(String url)
Read and return an RSS feed from a URL.
|
static com.rometools.rome.feed.synd.SyndFeed |
rss(String url,
boolean onlyNew)
Read and return an RSS feed from a URL.
|
static String |
rssToString(io.toro.gloop.object.property.GloopModel feedModel)
Get the string representation of a feed.
|
static void |
rssToWriter(io.toro.gloop.object.property.GloopModel feedModel,
Writer writer)
Writes a feed to a
Writer the XML representation of the feed. |
@Autowired RssMethods(@Lazy io.toro.martini.rss.SyndFeedClient syndFeedClient)
public static com.rometools.rome.feed.synd.SyndFeed rss(String url)
Read and return an RSS feed from a URL.
Loaded entries for any RSS URL will be cached at ${martini-home}/data/rss
.
Only new RSS feed items will be returned by this one-liner.
Example usage:
def feed = 'http://news.google.com/?output=rss'.rss() def titles = feed.entries.collect { it.title }
url
- the URL where the RSS feed will be read frompublic static com.rometools.rome.feed.synd.SyndFeed rss(String url, boolean onlyNew)
Read and return an RSS feed from a URL.
Loaded entries for any RSS URL will be cached at ${martini-home}/data/rss
.
Example usage:
def feed = 'http://news.google.com/?output=rss'.rss( false ) def titles = feed.entries.collect { it.title }
url
- the URL where the RSS feed will be read fromonlyNew
- flag determining whether or not only new RSS feed items will be included in the returned feed@GloopObjectParameter(value="output{\n RSSFeed#io.toro.martini.rss.Feed{\n }\n}") public static io.toro.gloop.object.property.GloopModel readRss(@GloopParameter(allowNull=false) String url)
Read and return an RSS feed from a URL.
Loaded entries for any RSS URL will be cached at ${martini-home}/data/rss
.
Only new RSS feed items will be returned by this one-liner.
Example usage:
def feed = 'http://news.google.com/?output=rss'.rss() def titles = feed.entries.collect { it.title }
url
- the URL where the RSS feed will be read from@GloopObjectParameter(value="output{\n RSSFeed#io.toro.martini.rss.Feed{\n }\n}") public static io.toro.gloop.object.property.GloopModel readRss(@GloopParameter(allowNull=false) String url, boolean onlyNew)
Read and return an RSS feed from a URL.
Loaded entries for any RSS URL will be cached at ${martini-home}/data/rss
.
Example usage:
def feed = 'http://news.google.com/?output=rss'.rss( false ) def titles = feed.entries.collect { it.title }
url
- the URL where the RSS feed will be read fromonlyNew
- flag determining whether or not only new RSS feed items will be included in the returned feedpublic static String rssToString(@GloopParameter(allowNull=false) io.toro.gloop.object.property.GloopModel feedModel) throws IOException, com.rometools.rome.io.FeedException
feedModel
- the feedIOException
- if there was any problem encountered when writing to the Writer
com.rometools.rome.io.FeedException
- if the XML representation of the feed cannot be createdpublic static void rssToWriter(@GloopParameter(allowNull=false) io.toro.gloop.object.property.GloopModel feedModel, @GloopParameter(allowNull=false) Writer writer) throws IOException, com.rometools.rome.io.FeedException
Writer
the XML representation of the feed.feedModel
- the feed to writewriter
- where the feed's XML representation will be writtenIOException
- if there was any problem encountered when writing to the Writer
com.rometools.rome.io.FeedException
- if the XML representation of the feed cannot be createdCopyright © 2020. All rights reserved.