Package io.toro.martini
Class RssMethods
- java.lang.Object
-
- io.toro.martini.RssMethods
-
public final class RssMethods extends Object
Contains one-liners for RSS-related operations.
-
-
Constructor Summary
Constructors Constructor Description RssMethods(SyndFeedClient syndFeedClient)
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static GloopModelreadRss(String url)Read and return an RSS feed from a URL.static GloopModelreadRss(String url, boolean onlyNew)Read and return an RSS feed from a URL.static SyndFeedrss(String url)Read and return an RSS feed from a URL.static SyndFeedrss(String url, boolean onlyNew)Read and return an RSS feed from a URL.static StringrssToString(GloopModel feedModel)Get the string representation of a feed.static voidrssToWriter(GloopModel feedModel, Writer writer)Writes a feed to aWriterthe XML representation of the feed.
-
-
-
Constructor Detail
-
RssMethods
@Autowired public RssMethods(@Lazy SyndFeedClient syndFeedClient)
-
-
Method Detail
-
rss
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 }- Parameters:
url- the URL where the RSS feed will be read from- Returns:
- the RSS feed from the provided URL
- Since:
- 1.0
-
rss
public 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 }- Parameters:
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- Returns:
- the RSS feed from the provided URL
- Since:
- 1.0
-
readRss
@GloopObjectParameter("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 }- Parameters:
url- the URL where the RSS feed will be read from- Returns:
- the RSS feed from the provided URL
- Since:
- 1.0
-
readRss
@GloopObjectParameter("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 }- Parameters:
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- Returns:
- the RSS feed from the provided URL
- Since:
- 1.0
-
rssToString
public static String rssToString(@GloopParameter(allowNull=false) GloopModel feedModel) throws IOException, FeedException
Get the string representation of a feed.- Parameters:
feedModel- the feed- Returns:
- an XML string representation of the provided feed
- Throws:
IOException- if there was any problem encountered when writing to theWriterFeedException- if the XML representation of the feed cannot be created
-
rssToWriter
public static void rssToWriter(@GloopParameter(allowNull=false) GloopModel feedModel, @GloopParameter(allowNull=false) Writer writer) throws IOException, FeedException
Writes a feed to aWriterthe XML representation of the feed.- Parameters:
feedModel- the feed to writewriter- where the feed's XML representation will be written- Throws:
IOException- if there was any problem encountered when writing to theWriterFeedException- if the XML representation of the feed cannot be created
-
-