public final class RssMethods extends Object
Contains one-liners for RSS-related operations.
Constructor and Description |
---|
RssMethods(SyndFeedClient syndFeedClient) |
Modifier and Type | Method and Description |
---|---|
static GloopModel |
readRss(String url)
Read and return an RSS feed from a URL.
|
static GloopModel |
readRss(String url,
boolean onlyNew)
Read and return an RSS feed from a URL.
|
static SyndFeed |
rss(String url)
Read and return an RSS feed from a URL.
|
static SyndFeed |
rss(String url,
boolean onlyNew)
Read and return an RSS feed from a URL.
|
static String |
rssToString(GloopModel feedModel)
Get the string representation of a feed.
|
static void |
rssToWriter(GloopModel feedModel,
Writer writer)
Writes a feed to a
Writer the XML representation of the feed. |
@Autowired RssMethods(@Lazy SyndFeedClient syndFeedClient)
public static 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 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 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 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) GloopModel feedModel) throws IOException, FeedException
feedModel
- the feedIOException
- if there was any problem encountered when writing to the Writer
FeedException
- if the XML representation of the feed cannot be createdpublic static void rssToWriter(@GloopParameter(allowNull=false) GloopModel feedModel, @GloopParameter(allowNull=false) Writer writer) throws IOException, 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
FeedException
- if the XML representation of the feed cannot be createdCopyright © 2023. All rights reserved.