18 package org.turro.elephant.impl.feed;
20 import com.sun.syndication.feed.synd.SyndFeed;
21 import com.sun.syndication.io.FeedException;
22 import com.sun.syndication.io.SyndFeedInput;
23 import com.sun.syndication.io.XmlReader;
24 import java.io.IOException;
25 import java.io.PrintWriter;
26 import java.net.MalformedURLException;
28 import javax.servlet.ServletException;
29 import org.turro.elephant.context.IElement;
30 import org.turro.elephant.impl.abstracts.AbstractElement;
31 import org.turro.elephant.impl.util.Localizer;
32 import org.turro.elephant.layout.IManageable;
33 import org.turro.elephant.layout.IRenderable;
34 import org.turro.marker.ElephantMarker;
56 String url[] =
getAttributes().getAttributeValue(
"attrib:feed",
"").split(
",");
57 SyndFeedInput input =
new SyndFeedInput();
60 for(
int i = 0; i < url.length; i++) {
61 feed = input.build(
new XmlReader(
new URL(url[i])));
62 renderFeed(out, feed);
64 }
catch (MalformedURLException | IllegalArgumentException | FeedException ex) {
65 throw new ServletException(ex);
73 return "<div class='rssreader'>";
81 private void renderFeed(PrintWriter out, SyndFeed feed) {
83 marker.
put(
"feed", feed);
AttributeSupport getAttributes()
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
IConstructor getConstructor()