本文整理汇总了Java中com.sun.syndication.feed.synd.SyndLinkImpl类的典型用法代码示例。如果您正苦于以下问题:Java SyndLinkImpl类的具体用法?Java SyndLinkImpl怎么用?Java SyndLinkImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SyndLinkImpl类属于com.sun.syndication.feed.synd包,在下文中一共展示了SyndLinkImpl类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLinks
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List getLinks() {
List<SyndLink> links = super.getLinks();
List<SyndLink> result = new ArrayList<SyndLink>(links.size());
for (SyndLink l : links) {
SyndLinkImpl ll = new SyndLinkImpl();
if (l != null) {
ll.setHref(removeInvalidChars(l.getHref()));
ll.setHreflang(removeInvalidChars(l.getHreflang()));
ll.setLength(l.getLength());
ll.setRel(removeInvalidChars(l.getRel()));
ll.setTitle(removeInvalidChars(l.getTitle()));
ll.setType(removeInvalidChars(l.getType()));
}
result.add(ll);
}
return result;
}
示例2: getLinks
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
@Override
public List<String> getLinks() {
List<String> result = new ArrayList<String>();
if (syndEntry.getLinks() != null) {
for (Iterator<?> iterator = syndEntry.getLinks().iterator(); iterator.hasNext(); ) {
SyndLinkImpl syndLink = (SyndLinkImpl)iterator.next();
result.add(syndLink.getHref());
}
}
if ((result.size() == 0) && (syndEntry.getLink() != null)) {
result.add(syndEntry.getLink());
}
return result;
}
示例3: createSyndLinks
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
protected List createSyndLinks(List aLinks) {
ArrayList sLinks = new ArrayList();
for (Iterator iter = aLinks.iterator(); iter.hasNext();) {
Link link = (Link)iter.next();
SyndLink sLink = new SyndLinkImpl();
sLink.setHref( link.getHref());
sLink.setType( link.getType());
sLink.setLength( link.getLength());
sLink.setHreflang( link.getHref());
sLinks.add(sLink);
}
return sLinks;
}
示例4: createSyndLink
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
public SyndLink createSyndLink(Feed feed, Entry entry, Link link) {
SyndLink syndLink = new SyndLinkImpl();
syndLink.setRel(link.getRel());
syndLink.setType(link.getType());
syndLink.setHref(link.getHref());
syndLink.setHreflang(link.getHreflang());
syndLink.setLength(link.getLength());
return syndLink;
}
示例5: createSyndLink
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
public SyndLink createSyndLink(Link link) {
SyndLink syndLink = new SyndLinkImpl();
syndLink.setRel( link.getRel());
syndLink.setType( link.getType());
syndLink.setHref( link.getHrefResolved());
syndLink.setHreflang(link.getHreflang());
syndLink.setLength( link.getLength());
syndLink.setTitle( link.getTitle());
return syndLink;
}
示例6: createSyndEntry
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
@Override
protected SyndEntry createSyndEntry(Item item, boolean preserveWireItem) {
SyndEntry syndEntry = super.createSyndEntry(item, preserveWireItem);
// adding native feed author to DC creators list
String author = item.getAuthor();
if (author!=null) {
List creators = ((DCModule)syndEntry.getModule(DCModule.URI)).getCreators();
if (!creators.contains(author)) {
Set s = new HashSet(); // using a set to remove duplicates
s.addAll(creators); // DC creators
s.add(author); // feed native author
creators.clear();
creators.addAll(s);
}
}
Guid guid = item.getGuid();
if (guid!=null) {
syndEntry.setUri(guid.getValue());
if (item.getLink()==null && guid.isPermaLink()) {
syndEntry.setLink(guid.getValue());
}
}
else {
syndEntry.setUri(item.getLink());
}
if(item.getComments() != null){
SyndLinkImpl comments = new SyndLinkImpl();
comments.setRel("comments");
comments.setHref(item.getComments());
comments.setType("text/html");
}
return syndEntry;
}
示例7: createSyndLink
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
public SyndLink createSyndLink(Link link) {
SyndLink syndLink = new SyndLinkImpl();
syndLink.setRel( link.getRel());
syndLink.setType( link.getType());
syndLink.setHref( link.getHrefResolved());
syndLink.setTitle( link.getTitle());
return syndLink;
}
示例8: createSyndLinks
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
protected List createSyndLinks(List aLinks) {
ArrayList sLinks = new ArrayList();
for (Iterator iter = aLinks.iterator(); iter.hasNext();) {
Link link = (Link)iter.next();
SyndLink sLink = new SyndLinkImpl();
sLink.setRel( link.getRel());
sLink.setHref( link.getHref());
sLink.setType( link.getType());
sLink.setTitle( link.getTitle());
sLink.setLength( link.getLength());
sLink.setHreflang( link.getHref());
sLinks.add(sLink);
}
return sLinks;
}
示例9: read
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
public void read() throws Exception {
FTPClient ftpClient = new FTPClient();
ftpClient.setBufferSize(1024 * 1024);
ftpClient.setDefaultTimeout(1000);
ftpClient.setControlEncoding("UTF-8");
ftpClient.setDataTimeout(10000);
ZipFile zipFile = new ZipFile();
Parser parser = new Parser();
URL feedUrl = new URL("https://download.kortforsyningen.dk/sites/default/files/feeds/MATRIKELKORT_GML.xml");
SyndFeedInput input = new SyndFeedInput();
System.out.println("Henter Atom feed....\n");
SyndFeed feed = input.build(new XmlReader(feedUrl));
System.out.println("Feed Titel: " + feed.getTitle());
Date lastPublishedDate;
Date currentDate;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String fileName;
Integer elavsKode;
Track track = new Track();
String lastStr = track.getLastFromDb();
lastPublishedDate = sdf.parse(lastStr);
System.out.println("\nSidste entry: " + lastStr + "\n");
this.login(ftpClient);
for (SyndEntry entry : (List<SyndEntry>) feed.getEntries()) {
System.out.println("\n--------------\n");
currentDate = entry.getPublishedDate();
if (currentDate.before(lastPublishedDate) || currentDate.equals(lastPublishedDate)) {
break;
}
System.out.println("Published Date: " + entry.getPublishedDate() + "\n");
// Get the Links
for (SyndLinkImpl link : (List<SyndLinkImpl>) entry.getLinks()) {
System.out.println("Link: " + link.getHref());
fileName = link.getHref().split("/")[7];
elavsKode = Integer.valueOf(fileName.split("_")[0]);
track.storeInDb(currentDate.toString(), elavsKode);
// Get the file
this.c(ftpClient, fileName, zipFile);
// Get xml stream from zip-file
ZipInputStream zin = zipFile.getGml(fileName);
// Parse the xml and insert in database
parser.build(zin, elavsKode);
// Delete the file
File file = new File(fileName);
file.delete();
}
}
// logout the user, returned true if logout successfully
ftpClient.disconnect();
System.out.println("Alt hentet...");
System.out.println("FTP forbindelse afbrydes.");
}
示例10: doPost
import com.sun.syndication.feed.synd.SyndLinkImpl; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String hubtopic = null;
String hubchallenge = null;
MessageStatus stsMessage = MessageStatus.ERROR;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(SyndFeedInput.class.getClassLoader());
if (request.getContentType().contains(MediaType.APPLICATION_ATOM_XML)
|| request.getContentType().contains(MediaType.APPLICATION_RSS_XML)) {
InputStream in = request.getInputStream();
try {
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(in));
List<SyndLinkImpl> linkList = feed.getLinks();
for (SyndLinkImpl link : linkList) {
if ("self".equals(link.getRel())) {
hubtopic = link.getHref();
}
}
if (hubtopic == null) {
hubtopic = feed.getUri();
}
topicUpdated(hubtopic, feed);
} catch (FeedException e) {
LOG.error("Failed in creating feed response.", e);
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
stsMessage = MessageStatus.OK;
}
response.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
switch (stsMessage) {
case OK:
response.setStatus(HttpStatus.SC_OK);
break;
case OK_CHALLENGE:
response.setStatus(HttpStatus.SC_OK);
response.getWriter().print(hubchallenge);
break;
default:
response.setStatus(HttpStatus.SC_NOT_FOUND);
break;
}
}