当前位置: 首页>>代码示例>>Java>>正文


Java SyndLinkImpl类代码示例

本文整理汇总了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;未经允许,请勿转载。