public int limit = 5;
public Object endpoint(String name, Params params) throws Exception {
String url = params.get("url");
String cacheKey = this.getClass().getName() + url;
Feed out = Cache.get(cacheKey, Feed.class);
if (out != null)
return out;
out = new Feed();
URL source = new URL(url);
SyndFeedInput raw = new SyndFeedInput();
SyndFeed feed = raw.build(new XmlReader(source));
Iterator<SyndEntry> itr = feed.getEntries().iterator();
int i = 0;
while( itr.hasNext() && i++ < limit) {
SyndEntry s = itr.next();
out.add(null, s.getTitle(), s.getLink());
}
Cache.set(cacheKey, out, "60s");
return out;
}