forked from Archives/Athou_commafeed
rome upgrade
This commit is contained in:
@@ -8,6 +8,7 @@ v 2.0.2
|
|||||||
- software version in user-agent when fetching feeds is no longer hardcoded
|
- software version in user-agent when fetching feeds is no longer hardcoded
|
||||||
- admin settings page is now read only, settings are configured in config.yml
|
- admin settings page is now read only, settings are configured in config.yml
|
||||||
- added link to metrics on the admin settings page
|
- added link to metrics on the admin settings page
|
||||||
|
- Rome (rss library) upgrade to 1.5.0
|
||||||
v 2.0.1
|
v 2.0.1
|
||||||
- the redis pool no longer throws an exception when it is unable to aquire a new connection
|
- the redis pool no longer throws an exception when it is unable to aquire a new connection
|
||||||
v2.0.0
|
v2.0.0
|
||||||
|
|||||||
31
pom.xml
31
pom.xml
@@ -197,9 +197,9 @@
|
|||||||
<version>2.4</version>
|
<version>2.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-collections</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-collections</artifactId>
|
<artifactId>commons-collections4</artifactId>
|
||||||
<version>3.2.1</version>
|
<version>4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
@@ -222,31 +222,14 @@
|
|||||||
<version>1.5.2</version>
|
<version>1.5.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.java.dev.rome</groupId>
|
<groupId>com.rometools</groupId>
|
||||||
<artifactId>rome</artifactId>
|
<artifactId>rome</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.5.0</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>jdom</groupId>
|
|
||||||
<artifactId>jdom</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.rometools</groupId>
|
<groupId>com.rometools</groupId>
|
||||||
<artifactId>rome-opml</artifactId>
|
<artifactId>rome-opml</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.5.0</version>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>rome</groupId>
|
|
||||||
<artifactId>rome</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jdom</groupId>
|
|
||||||
<artifactId>jdom</artifactId>
|
|
||||||
<version>1.1.3</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import com.commafeed.backend.HttpGetter;
|
|||||||
import com.commafeed.backend.HttpGetter.HttpResult;
|
import com.commafeed.backend.HttpGetter.HttpResult;
|
||||||
import com.commafeed.backend.HttpGetter.NotModifiedException;
|
import com.commafeed.backend.HttpGetter.NotModifiedException;
|
||||||
import com.commafeed.backend.model.Feed;
|
import com.commafeed.backend.model.Feed;
|
||||||
import com.sun.syndication.io.FeedException;
|
import com.rometools.rome.io.FeedException;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.jdom.Element;
|
import org.jdom2.Element;
|
||||||
import org.jdom.Namespace;
|
import org.jdom2.Namespace;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
import com.commafeed.backend.model.Feed;
|
import com.commafeed.backend.model.Feed;
|
||||||
@@ -19,14 +19,14 @@ import com.commafeed.backend.model.FeedEntryContent;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.sun.syndication.feed.synd.SyndContent;
|
import com.rometools.rome.feed.synd.SyndContent;
|
||||||
import com.sun.syndication.feed.synd.SyndEnclosure;
|
import com.rometools.rome.feed.synd.SyndEnclosure;
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
import com.rometools.rome.feed.synd.SyndEntry;
|
||||||
import com.sun.syndication.feed.synd.SyndFeed;
|
import com.rometools.rome.feed.synd.SyndFeed;
|
||||||
import com.sun.syndication.feed.synd.SyndLink;
|
import com.rometools.rome.feed.synd.SyndLink;
|
||||||
import com.sun.syndication.feed.synd.SyndLinkImpl;
|
import com.rometools.rome.feed.synd.SyndLinkImpl;
|
||||||
import com.sun.syndication.io.FeedException;
|
import com.rometools.rome.io.FeedException;
|
||||||
import com.sun.syndication.io.SyndFeedInput;
|
import com.rometools.rome.io.SyndFeedInput;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FeedParser {
|
public class FeedParser {
|
||||||
@@ -38,12 +38,12 @@ public class FeedParser {
|
|||||||
private static final Date END = new Date(1000l * Integer.MAX_VALUE - 86400000);
|
private static final Date END = new Date(1000l * Integer.MAX_VALUE - 86400000);
|
||||||
|
|
||||||
private static final Function<SyndContent, String> CONTENT_TO_STRING = new Function<SyndContent, String>() {
|
private static final Function<SyndContent, String> CONTENT_TO_STRING = new Function<SyndContent, String>() {
|
||||||
|
@Override
|
||||||
public String apply(SyndContent content) {
|
public String apply(SyndContent content) {
|
||||||
return content.getValue();
|
return content.getValue();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public FetchedFeed parse(String feedUrl, byte[] xml) throws FeedException {
|
public FetchedFeed parse(String feedUrl, byte[] xml) throws FeedException {
|
||||||
FetchedFeed fetchedFeed = new FetchedFeed();
|
FetchedFeed fetchedFeed = new FetchedFeed();
|
||||||
Feed feed = fetchedFeed.getFeed();
|
Feed feed = fetchedFeed.getFeed();
|
||||||
@@ -91,7 +91,7 @@ public class FeedParser {
|
|||||||
content.setContent(getContent(item));
|
content.setContent(getContent(item));
|
||||||
content.setTitle(getTitle(item));
|
content.setTitle(getTitle(item));
|
||||||
content.setAuthor(StringUtils.trimToNull(item.getAuthor()));
|
content.setAuthor(StringUtils.trimToNull(item.getAuthor()));
|
||||||
SyndEnclosure enclosure = (SyndEnclosure) Iterables.getFirst(item.getEnclosures(), null);
|
SyndEnclosure enclosure = Iterables.getFirst(item.getEnclosures(), null);
|
||||||
if (enclosure != null) {
|
if (enclosure != null) {
|
||||||
content.setEnclosureUrl(FeedUtils.truncate(enclosure.getUrl(), 2048));
|
content.setEnclosureUrl(FeedUtils.truncate(enclosure.getUrl(), 2048));
|
||||||
content.setEnclosureType(enclosure.getType());
|
content.setEnclosureType(enclosure.getType());
|
||||||
@@ -121,24 +121,17 @@ public class FeedParser {
|
|||||||
/**
|
/**
|
||||||
* Adds atom links for rss feeds
|
* Adds atom links for rss feeds
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
||||||
private void handleForeignMarkup(SyndFeed feed) {
|
private void handleForeignMarkup(SyndFeed feed) {
|
||||||
Object foreignMarkup = feed.getForeignMarkup();
|
List<Element> foreignMarkup = feed.getForeignMarkup();
|
||||||
if (foreignMarkup == null) {
|
if (foreignMarkup == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (foreignMarkup instanceof List) {
|
for (Element element : foreignMarkup) {
|
||||||
List elements = (List) foreignMarkup;
|
if ("link".equals(element.getName()) && ATOM_10_NS.equals(element.getNamespace())) {
|
||||||
for (Object object : elements) {
|
SyndLink link = new SyndLinkImpl();
|
||||||
if (object instanceof Element) {
|
link.setRel(element.getAttributeValue("rel"));
|
||||||
Element element = (Element) object;
|
link.setHref(element.getAttributeValue("href"));
|
||||||
if ("link".equals(element.getName()) && ATOM_10_NS.equals(element.getNamespace())) {
|
feed.getLinks().add(link);
|
||||||
SyndLink link = new SyndLinkImpl();
|
|
||||||
link.setRel(element.getAttributeValue("rel"));
|
|
||||||
link.setHref(element.getAttributeValue("href"));
|
|
||||||
feed.getLinks().add(link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +162,6 @@ public class FeedParser {
|
|||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private String getContent(SyndEntry item) {
|
private String getContent(SyndEntry item) {
|
||||||
String content = null;
|
String content = null;
|
||||||
if (item.getContents().isEmpty()) {
|
if (item.getContents().isEmpty()) {
|
||||||
@@ -193,9 +185,8 @@ public class FeedParser {
|
|||||||
return StringUtils.trimToNull(title);
|
return StringUtils.trimToNull(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private String findHub(SyndFeed feed) {
|
private String findHub(SyndFeed feed) {
|
||||||
for (SyndLink l : (List<SyndLink>) feed.getLinks()) {
|
for (SyndLink l : feed.getLinks()) {
|
||||||
if ("hub".equalsIgnoreCase(l.getRel())) {
|
if ("hub".equalsIgnoreCase(l.getRel())) {
|
||||||
log.debug("found hub {} for feed {}", l.getHref(), feed.getLink());
|
log.debug("found hub {} for feed {}", l.getHref(), feed.getLink());
|
||||||
return l.getHref();
|
return l.getHref();
|
||||||
@@ -204,9 +195,8 @@ public class FeedParser {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private String findSelf(SyndFeed feed) {
|
private String findSelf(SyndFeed feed) {
|
||||||
for (SyndLink l : (List<SyndLink>) feed.getLinks()) {
|
for (SyndLink l : feed.getLinks()) {
|
||||||
if ("self".equalsIgnoreCase(l.getRel())) {
|
if ("self".equalsIgnoreCase(l.getRel())) {
|
||||||
log.debug("found self {} for feed {}", l.getHref(), feed.getLink());
|
log.debug("found self {} for feed {}", l.getHref(), feed.getLink());
|
||||||
return l.getHref();
|
return l.getHref();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.util.concurrent.locks.Lock;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.time.DateUtils;
|
import org.apache.commons.lang.time.DateUtils;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
|||||||
import com.commafeed.backend.model.FeedCategory;
|
import com.commafeed.backend.model.FeedCategory;
|
||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.sun.syndication.feed.opml.Attribute;
|
import com.rometools.opml.feed.opml.Attribute;
|
||||||
import com.sun.syndication.feed.opml.Opml;
|
import com.rometools.opml.feed.opml.Opml;
|
||||||
import com.sun.syndication.feed.opml.Outline;
|
import com.rometools.opml.feed.opml.Outline;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class OPMLExporter {
|
public class OPMLExporter {
|
||||||
@@ -20,7 +20,6 @@ public class OPMLExporter {
|
|||||||
private final FeedCategoryDAO feedCategoryDAO;
|
private final FeedCategoryDAO feedCategoryDAO;
|
||||||
private final FeedSubscriptionDAO feedSubscriptionDAO;
|
private final FeedSubscriptionDAO feedSubscriptionDAO;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Opml export(User user) {
|
public Opml export(User user) {
|
||||||
Opml opml = new Opml();
|
Opml opml = new Opml();
|
||||||
opml.setFeedType("opml_1.1");
|
opml.setFeedType("opml_1.1");
|
||||||
@@ -48,7 +47,6 @@ public class OPMLExporter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Outline buildCategoryOutline(FeedCategory cat, List<FeedSubscription> subscriptions) {
|
private Outline buildCategoryOutline(FeedCategory cat, List<FeedSubscription> subscriptions) {
|
||||||
Outline outline = new Outline();
|
Outline outline = new Outline();
|
||||||
outline.setText(cat.getName());
|
outline.setText(cat.getName());
|
||||||
@@ -66,7 +64,6 @@ public class OPMLExporter {
|
|||||||
return outline;
|
return outline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Outline buildSubscriptionOutline(FeedSubscription sub) {
|
private Outline buildSubscriptionOutline(FeedSubscription sub) {
|
||||||
Outline outline = new Outline();
|
Outline outline = new Outline();
|
||||||
outline.setText(sub.getTitle());
|
outline.setText(sub.getTitle());
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import com.commafeed.backend.cache.CacheService;
|
import com.commafeed.backend.cache.CacheService;
|
||||||
@@ -15,9 +15,9 @@ import com.commafeed.backend.model.FeedCategory;
|
|||||||
import com.commafeed.backend.model.User;
|
import com.commafeed.backend.model.User;
|
||||||
import com.commafeed.backend.service.FeedSubscriptionService;
|
import com.commafeed.backend.service.FeedSubscriptionService;
|
||||||
import com.commafeed.backend.service.FeedSubscriptionService.FeedSubscriptionException;
|
import com.commafeed.backend.service.FeedSubscriptionService.FeedSubscriptionException;
|
||||||
import com.sun.syndication.feed.opml.Opml;
|
import com.rometools.opml.feed.opml.Opml;
|
||||||
import com.sun.syndication.feed.opml.Outline;
|
import com.rometools.opml.feed.opml.Outline;
|
||||||
import com.sun.syndication.io.WireFeedInput;
|
import com.rometools.rome.io.WireFeedInput;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class OPMLImporter {
|
public class OPMLImporter {
|
||||||
@@ -33,7 +33,6 @@ public class OPMLImporter {
|
|||||||
this.cache = cache;
|
this.cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void importOpml(User user, String xml) {
|
public void importOpml(User user, String xml) {
|
||||||
xml = xml.substring(xml.indexOf('<'));
|
xml = xml.substring(xml.indexOf('<'));
|
||||||
WireFeedInput input = new WireFeedInput();
|
WireFeedInput input = new WireFeedInput();
|
||||||
@@ -49,7 +48,6 @@ public class OPMLImporter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void handleOutline(User user, Outline outline, FeedCategory parent) {
|
private void handleOutline(User user, Outline outline, FeedCategory parent) {
|
||||||
List<Outline> children = outline.getChildren();
|
List<Outline> children = outline.getChildren();
|
||||||
if (CollectionUtils.isNotEmpty(children)) {
|
if (CollectionUtils.isNotEmpty(children)) {
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
package com.commafeed.backend.rome;
|
package com.commafeed.backend.rome;
|
||||||
|
|
||||||
import org.jdom.Element;
|
import org.jdom2.Element;
|
||||||
|
|
||||||
import com.sun.syndication.feed.opml.Opml;
|
import com.rometools.opml.feed.opml.Opml;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add missing title to the generated OPML
|
* Add missing title to the generated OPML
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OPML11Generator extends com.sun.syndication.io.impl.OPML10Generator {
|
public class OPML11Generator extends com.rometools.opml.io.impl.OPML10Generator {
|
||||||
|
|
||||||
public OPML11Generator() {
|
public OPML11Generator() {
|
||||||
super("opml_1.1");
|
super("opml_1.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Element generateHead(Opml opml) {
|
protected Element generateHead(Opml opml) {
|
||||||
Element head = new Element("head");
|
Element head = new Element("head");
|
||||||
addNotNullSimpleElement(head, "title", opml.getTitle());
|
addNotNullSimpleElement(head, "title", opml.getTitle());
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.commafeed.backend.rome;
|
package com.commafeed.backend.rome;
|
||||||
|
|
||||||
import org.jdom.Document;
|
import org.jdom2.Document;
|
||||||
import org.jdom.Element;
|
import org.jdom2.Element;
|
||||||
|
|
||||||
import com.sun.syndication.io.impl.OPML10Parser;
|
import com.rometools.opml.io.impl.OPML10Parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support for OPML 1.1 parsing
|
* Support for OPML 1.1 parsing
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.commafeed.backend.rome;
|
package com.commafeed.backend.rome;
|
||||||
|
|
||||||
import com.sun.syndication.feed.rss.Description;
|
import com.rometools.rome.feed.rss.Description;
|
||||||
import com.sun.syndication.feed.rss.Item;
|
import com.rometools.rome.feed.rss.Item;
|
||||||
import com.sun.syndication.feed.synd.SyndContentImpl;
|
import com.rometools.rome.feed.synd.SyndContentImpl;
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
import com.rometools.rome.feed.synd.SyndEntry;
|
||||||
import com.sun.syndication.feed.synd.impl.ConverterForRSS090;
|
import com.rometools.rome.feed.synd.impl.ConverterForRSS090;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support description tag for RSS09
|
* Support description tag for RSS09
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.commafeed.backend.rome;
|
package com.commafeed.backend.rome;
|
||||||
|
|
||||||
import org.jdom.Element;
|
import java.util.Locale;
|
||||||
|
|
||||||
import com.sun.syndication.feed.rss.Description;
|
import org.jdom2.Element;
|
||||||
import com.sun.syndication.feed.rss.Item;
|
|
||||||
import com.sun.syndication.io.impl.RSS090Parser;
|
import com.rometools.rome.feed.rss.Description;
|
||||||
|
import com.rometools.rome.feed.rss.Item;
|
||||||
|
import com.rometools.rome.io.impl.RSS090Parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support description tag for RSS09
|
* Support description tag for RSS09
|
||||||
@@ -13,9 +15,8 @@ import com.sun.syndication.io.impl.RSS090Parser;
|
|||||||
public class RSS090DescriptionParser extends RSS090Parser {
|
public class RSS090DescriptionParser extends RSS090Parser {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Item parseItem(Element rssRoot, Element eItem) {
|
protected Item parseItem(Element rssRoot, Element eItem, Locale locale) {
|
||||||
Item item = super.parseItem(rssRoot, eItem);
|
Item item = super.parseItem(rssRoot, eItem, locale);
|
||||||
|
|
||||||
Element e = eItem.getChild("description", getRSSNamespace());
|
Element e = eItem.getChild("description", getRSSNamespace());
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
Description desc = new Description();
|
Description desc = new Description();
|
||||||
@@ -25,5 +26,4 @@ public class RSS090DescriptionParser extends RSS090Parser {
|
|||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package com.commafeed.backend.rome;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.jdom.Document;
|
import org.jdom2.Document;
|
||||||
import org.jdom.Element;
|
import org.jdom2.Element;
|
||||||
import org.jdom.Namespace;
|
import org.jdom2.Namespace;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sun.syndication.io.impl.RSS10Parser;
|
import com.rometools.rome.io.impl.RSS10Parser;
|
||||||
|
|
||||||
public class RSSRDF10Parser extends RSS10Parser {
|
public class RSSRDF10Parser extends RSS10Parser {
|
||||||
|
|
||||||
@@ -19,14 +19,13 @@ public class RSSRDF10Parser extends RSS10Parser {
|
|||||||
super("rss_1.0", RSS_NS);
|
super("rss_1.0", RSS_NS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMyType(Document document) {
|
public boolean isMyType(Document document) {
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
|
|
||||||
Element rssRoot = document.getRootElement();
|
Element rssRoot = document.getRootElement();
|
||||||
Namespace defaultNS = rssRoot.getNamespace();
|
Namespace defaultNS = rssRoot.getNamespace();
|
||||||
List additionalNSs = Lists.newArrayList(rssRoot.getAdditionalNamespaces());
|
List<Namespace> additionalNSs = Lists.newArrayList(rssRoot.getAdditionalNamespaces());
|
||||||
List<Element> children = rssRoot.getChildren();
|
List<Element> children = rssRoot.getChildren();
|
||||||
if (CollectionUtils.isNotEmpty(children)) {
|
if (CollectionUtils.isNotEmpty(children)) {
|
||||||
Element child = children.get(0);
|
Element child = children.get(0);
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ import com.commafeed.backend.model.FeedEntryStatus;
|
|||||||
import com.commafeed.backend.model.FeedEntryTag;
|
import com.commafeed.backend.model.FeedEntryTag;
|
||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sun.syndication.feed.synd.SyndContentImpl;
|
import com.rometools.rome.feed.synd.SyndContent;
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
import com.rometools.rome.feed.synd.SyndContentImpl;
|
||||||
import com.sun.syndication.feed.synd.SyndEntryImpl;
|
import com.rometools.rome.feed.synd.SyndEntry;
|
||||||
|
import com.rometools.rome.feed.synd.SyndEntryImpl;
|
||||||
import com.wordnik.swagger.annotations.ApiModel;
|
import com.wordnik.swagger.annotations.ApiModel;
|
||||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ public class Entry implements Serializable {
|
|||||||
|
|
||||||
SyndContentImpl content = new SyndContentImpl();
|
SyndContentImpl content = new SyndContentImpl();
|
||||||
content.setValue(getContent());
|
content.setValue(getContent());
|
||||||
entry.setContents(Arrays.asList(content));
|
entry.setContents(Arrays.<SyndContent> asList(content));
|
||||||
entry.setLink(getUrl());
|
entry.setLink(getUrl());
|
||||||
entry.setPublishedDate(getDate());
|
entry.setPublishedDate(getDate());
|
||||||
return entry;
|
return entry;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import javax.ws.rs.core.Response.Status;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang.ObjectUtils;
|
import org.apache.commons.lang.ObjectUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
@@ -56,10 +56,10 @@ import com.commafeed.frontend.model.request.MarkRequest;
|
|||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
import com.rometools.rome.feed.synd.SyndEntry;
|
||||||
import com.sun.syndication.feed.synd.SyndFeed;
|
import com.rometools.rome.feed.synd.SyndFeed;
|
||||||
import com.sun.syndication.feed.synd.SyndFeedImpl;
|
import com.rometools.rome.feed.synd.SyndFeedImpl;
|
||||||
import com.sun.syndication.io.SyndFeedOutput;
|
import com.rometools.rome.io.SyndFeedOutput;
|
||||||
import com.wordnik.swagger.annotations.Api;
|
import com.wordnik.swagger.annotations.Api;
|
||||||
import com.wordnik.swagger.annotations.ApiOperation;
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
import com.wordnik.swagger.annotations.ApiParam;
|
import com.wordnik.swagger.annotations.ApiParam;
|
||||||
|
|||||||
@@ -70,13 +70,13 @@ import com.commafeed.frontend.model.request.SubscribeRequest;
|
|||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.rometools.opml.feed.opml.Opml;
|
||||||
|
import com.rometools.rome.feed.synd.SyndEntry;
|
||||||
|
import com.rometools.rome.feed.synd.SyndFeed;
|
||||||
|
import com.rometools.rome.feed.synd.SyndFeedImpl;
|
||||||
|
import com.rometools.rome.io.SyndFeedOutput;
|
||||||
|
import com.rometools.rome.io.WireFeedOutput;
|
||||||
import com.sun.jersey.multipart.FormDataParam;
|
import com.sun.jersey.multipart.FormDataParam;
|
||||||
import com.sun.syndication.feed.opml.Opml;
|
|
||||||
import com.sun.syndication.feed.synd.SyndEntry;
|
|
||||||
import com.sun.syndication.feed.synd.SyndFeed;
|
|
||||||
import com.sun.syndication.feed.synd.SyndFeedImpl;
|
|
||||||
import com.sun.syndication.io.SyndFeedOutput;
|
|
||||||
import com.sun.syndication.io.WireFeedOutput;
|
|
||||||
import com.wordnik.swagger.annotations.Api;
|
import com.wordnik.swagger.annotations.Api;
|
||||||
import com.wordnik.swagger.annotations.ApiOperation;
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
import com.wordnik.swagger.annotations.ApiParam;
|
import com.wordnik.swagger.annotations.ApiParam;
|
||||||
|
|||||||
Reference in New Issue
Block a user