• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SyndLinkImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;
}
 
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:20,代码来源:ExtendedSyndEntryImpl.java


示例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;
}
 
开发者ID:cert-se,项目名称:megatron-java,代码行数:18,代码来源:RomeRssItem.java


示例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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:ConverterForAtom10.java


示例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;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:10,代码来源:ConverterForAtom10.java


示例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;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:11,代码来源:ConverterForAtom10.java


示例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;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:36,代码来源:ConverterForRSS094.java


示例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;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:9,代码来源:ConverterForAtom03.java


示例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;
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:16,代码来源:ConverterForAtom10.java


示例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.");


}
 
开发者ID:mapcentia,项目名称:AtomMatrikel,代码行数:71,代码来源:Downloader.java


示例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;
    }

}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:60,代码来源:CallbackServlet.java



注:本文中的com.sun.syndication.feed.synd.SyndLinkImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FastForwardMode类代码示例发布时间:2022-05-23
下一篇:
Java RepositoriesModule类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap