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


Java SyndEntry.getUri方法代码示例

本文整理汇总了Java中com.sun.syndication.feed.synd.SyndEntry.getUri方法的典型用法代码示例。如果您正苦于以下问题:Java SyndEntry.getUri方法的具体用法?Java SyndEntry.getUri怎么用?Java SyndEntry.getUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.syndication.feed.synd.SyndEntry的用法示例。


在下文中一共展示了SyndEntry.getUri方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SyndEntryAdapter

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
public SyndEntryAdapter(SyndFeed feed, SyndEntry entry) {
    if (entry.getTitleEx() != null) {
        this.title = entry.getTitle();
        this.titleType = entry.getTitleEx().getType();
    }
    if (entry.getDescription() != null) {
        this.description = entry.getDescription().getValue();
        this.descriptionType = entry.getDescription().getType();
    }
    this.uri = entry.getUri();
    this.author = entry.getAuthor();
    this.link = entry.getLink();

    if (entry.getPublishedDate() != null)
        this.publishedDate = ISO_8601_DATE_FORMAT.format(entry.getPublishedDate());
    if (entry.getUpdatedDate() != null)
        this.updatedDate = ISO_8601_DATE_FORMAT.format(entry.getUpdatedDate());
    this.fetchDate = ISO_8601_DATE_FORMAT.format(new Date());

    this.sourceLink = feed.getLink();
    this.sourceUri = feed.getUri();
    this.sourceTitle = feed.getTitle();
    this.language = feed.getLanguage();
    this.sourceType = feed.getFeedType();
}
 
开发者ID:marozau,项目名称:expresso,代码行数:26,代码来源:SyndEntryAdapter.java

示例2: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent desc = sEntry.getDescription();
    if (desc!=null) {
        item.setDescription(createItemDescription(desc));
    }
    List contents = sEntry.getContents();
    if (contents!=null && contents.size() > 0) {
        item.setContent(createItemContent((SyndContent)contents.get(0)));
    }
    
    String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }
    
    return item;
}
 
开发者ID:4thline,项目名称:feeds,代码行数:21,代码来源:ConverterForRSS10.java

示例3: handleChannelMessage

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
protected void handleChannelMessage(Connection connection, String channel, String fromNickname, String text, List<String> textAsList, Message message,
        HandlerContext handlerContext) throws Exception {
    String url = getUrl(textAsList, handlerContext);
    SyndEntry latestEntry = getLatestEntry(url);
    if (latestEntry == null) return;
    String entryLink = latestEntry.getLink();
    if (entryLink == null) {
        entryLink = latestEntry.getUri();
    }
    if (entryLink == null) {
        if (Config.LOGD) Log.d(TAG, "handleChannelMessage Could not get link for this entry");
        return;
    }
    String entryTitle = latestEntry.getTitle();
    connection.send(Command.PRIVMSG, channel, entryTitle + " " + entryLink);
}
 
开发者ID:BoD,项目名称:irondad,代码行数:18,代码来源:FeedHandler.java

示例4: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent desc = sEntry.getDescription();
    if (desc!=null) {
        item.setDescription(createItemDescription(desc));
    }
    List contents = sEntry.getContents();
    if (contents!=null && contents.size() > 0) {
        item.setContent(createItemContent((SyndContent)contents.get(0)));
    }
    
    String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }
    
    return item;
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:20,代码来源:ConverterForRSS10.java

示例5: getAllPostsFromFeed

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
public static List getAllPostsFromFeed(String urlToGet, String source) throws IOException, FeedException {

        ArrayList<BlogPost> posts = new ArrayList<BlogPost>();

        URL url = new URL(urlToGet);
        SyndFeedInput input = new SyndFeedInput();
        try {
            SyndFeed feed = input.build(new XmlReader(url));

            int items = feed.getEntries().size();

            if (items > 0) {
                log.info("Attempting to parse rss feed: " + urlToGet);
                log.info("This Feed has " + items + " items");
                List<SyndEntry> entries = feed.getEntries();

                for (SyndEntry item : entries) {
                    if (item.getContents().size() > 0) {
                        SyndContentImpl contentHolder = (SyndContentImpl) item.getContents().get(0);
                        String content = contentHolder.getValue();
                        if (content != null && !content.isEmpty()) {
                            BlogPost post = new BlogPost(content, null, null, source, item.getLink(), item.getUri(), null);
                            posts.add(post);
                        }
                    }
                }
            }
            return posts;
        }
        catch(Exception ex){
            log.error(ex);
            return posts;
        }

    }
 
开发者ID:gidim,项目名称:Babler,代码行数:36,代码来源:RSSScraper.java

示例6: createRSSItem

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
protected Item createRSSItem(SyndEntry sEntry) {
    Item item = super.createRSSItem(sEntry);

    SyndContent sContent = sEntry.getDescription();
    if (sContent!=null) {
        item.setDescription(createItemDescription(sContent));
    }
    
    String uri = sEntry.getUri();
    if (uri != null) {
        item.setUri(uri);
    }
    
    return item;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:ConverterForRSS10.java

示例7: fetchAndSave

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
public AbstractMap.SimpleEntry<Integer, Integer> fetchAndSave() throws Exception {

        URL url = new URL(this.url);

        SyndFeedInput input = new SyndFeedInput();
        SyndFeed feed = input.build(new XmlReader(url));


        int items = feed.getEntries().size();

        if(items > 0){
            log.info("Attempting to parse rss feed: "+ this.url );
            log.info("This Feed has "+items +" items");
        }

        List <SyndEntry> entries = feed.getEntries();

        for (SyndEntry item : entries){
            log.info("Title: " + item.getTitle());
            log.info("Link: " + item.getLink());
            SyndContentImpl contentHolder = (SyndContentImpl) item.getContents().get(0);
            String content = contentHolder.getValue();

            //content might contain html data, let's clean it up
            Document doc = Jsoup.parse(content);
            content = doc.text();
            try {
                    Result result = ld.detectLanguage(content, language);
                    if (result.languageCode.equals(language) && result.isReliable) {

                        FileSaver file = new FileSaver(content, this.language, "bs", item.getLink(), item.getUri(), String.valueOf(content.hashCode()));
                        String fileName = file.getFileName();
                        BlogPost post = new BlogPost(content,this.language,null,"bs",item.getLink(),item.getUri(),fileName);
                        if(DAO.saveEntry(post)) {
                            file.save(this.logDb);
                            numOfFiles++;
                            wrongCount = 0;
                        }

                    }

                    else{
                        log.info("Item " + item.getTitle() + "is in a diff languageCode, skipping this post  "+ result.languageCode);
                        wrongCount ++;
                        if(wrongCount > 3){
                            log.info("Already found 3 posts in the wrong languageCode, skipping this blog");
                        }
                        break;
                    }

            }
            catch(Exception e){
                log.error(e);
                break;
            }


        }
        return new AbstractMap.SimpleEntry<>(numOfFiles,wrongCount);
    }
 
开发者ID:gidim,项目名称:Babler,代码行数:61,代码来源:RSSScraper.java

示例8: parse

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void parse() throws Exception {
	SyndFeedInput input = new SyndFeedInput();
	byte b[] = downloadAndSendBinary(url);
	if (b != null) {
		SyndFeed feed = input.build(new XmlReader(new ByteArrayInputStream(b)));
		name = feed.getTitle();
		if (feed.getCategories() != null && feed.getCategories().size() > 0) {
			SyndCategory category = (SyndCategory) feed.getCategories().get(0);
			tempCategory = category.getName();
		}
		List<SyndEntry> entries = feed.getEntries();
		for (SyndEntry entry : entries) {
			tempItemTitle = entry.getTitle();
			tempItemLink = entry.getLink();
			tempFeedLink = entry.getUri();
			tempItemThumbURL = null;

			ArrayList<Element> elements = (ArrayList<Element>) entry.getForeignMarkup();
			for (Element elt : elements) {
				if ("group".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())) {
					List<Content> subElts = elt.getContent();
					for (Content subelt : subElts) {
						if (subelt instanceof Element) {
							parseElement((Element) subelt, false);
						}
					}
				}
				parseElement(elt, true);
			}
			List<SyndEnclosure> enclosures = entry.getEnclosures();
			for (SyndEnclosure enc : enclosures) {
				if (StringUtils.isNotBlank(enc.getUrl())) {
					tempItemLink = enc.getUrl();
				}
			}
			manageItem();
		}
	}
	setLastModified(System.currentTimeMillis());
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:42,代码来源:Feed.java

示例9: create

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
private void create(SyndEntry entry, NewswireService source) throws DataExistsException {
    List<NewswireItem> results = pluginContext.findNewswireItemsByExternalId(entry.getUri());

    if (results.isEmpty()) {

        NewswireItem item = new NewswireItem();
        item.setExternalId(entry.getUri());
        item.setTitle(StringUtils.stripHtml(entry.getTitle()));
        if (entry.getDescription() != null) {
            item.setSummary(StringUtils.stripHtml(entry.getDescription().getValue()));
        }
        item.setUrl(entry.getLink());
        item.setNewswireService(source);
        item.setAuthor(entry.getAuthor());
        Calendar now = Calendar.getInstance();
        item.setDate(now);
        item.setUpdated(now);

        if (entry.getPublishedDate() != null) {
            item.getDate().setTime(entry.getPublishedDate());
            item.getUpdated().setTime(entry.getPublishedDate());
        }

        if (entry.getUpdatedDate() != null) {
            item.getUpdated().setTime(entry.getUpdatedDate());
        }

        if (useOpenCalais) {
            enrich(pluginContext, item);
        }
        NewswireItem nwi = pluginContext.createNewswireItem(item);
        try {
            pluginContext.index(nwi);
        } catch (SearchEngineIndexingException ex) {
            pluginContext.log(LogSeverity.SEVERE, ex.getMessage(),
                    this.newswireService, this.newswireService.getId());
        }
    } else {
        throw new DataExistsException("NewswireItem with external id [" + entry.getUri() + "] already downloaded");
    }
}
 
开发者ID:getconverge,项目名称:converge-1.x,代码行数:42,代码来源:RssDecoder.java

示例10: loop

import com.sun.syndication.feed.synd.SyndEntry; //导入方法依赖的package包/类
@Override
@SuppressWarnings( "unchecked" )
protected void loop()
    throws Exception
{
    final URL url = new URL( getProperties().getConfigString( "url" ) );

    final int max = getProperties().getConfigInteger( "max" );

    if ( LOGGER.isTraceEnabled() )
    {
        LOGGER.trace( "[" + getNodeID() + "] read feed : " + url + " with max " + max + " elements" );
    }

    final SyndFeedInput input = new SyndFeedInput();
    final SyndFeed feed = input.build( new XmlReader( url ) );

    int count = 0;
    final List<SyndEntry> entries = feed.getEntries();
    for ( final SyndEntry entry : entries )
    {
        if ( entry.getUri() != null )
        {
            // Tags
            final Tags tags = new Tags();

            final List<SyndCategory> categories = entry.getCategories();
            if ( categories != null )
            {
                for ( final SyndCategory category : categories )
                {
                    tags.add( category.getName() );
                }
            }

            setMessage( Message.create(
                Message.KeyIndex.URI ,
                new URI( entry.getUri() ) ,
                Message.KeyIndex.TAGS ,
                tags
            ) );

            // Title
            if ( entry.getTitle() != null )
            {
                getMessage().setProperty( Message.KeyIndex.TITLE ,
                                          HTMLhelper.cleanHTML( entry.getTitle() ) );
            }

            // Description
            if ( entry.getDescription() != null )
            {
                getMessage().setProperty( Message.KeyIndex.DESCRIPTION ,
                                          HTMLhelper.cleanHTML( entry.getDescription().getValue() ) );
            }

            // Author
            if ( entry.getAuthor() != null )
            {
                getMessage().setProperty( Message.KeyIndex.AUTHOR ,
                                          entry.getAuthor() );
            }

            // Published date
            if ( entry.getPublishedDate() != null )
            {
                getMessage().setProperty( Message.KeyIndex.PUBLISHED_DATE ,
                                          new DateTime( entry.getPublishedDate() ) );
            }

            sendMessage();
        }

        ++count;

        if ( count >= max )
        {
            break;
        }
    }
}
 
开发者ID:fabienvauchelles,项目名称:superpipes,代码行数:82,代码来源:N_RSS.java


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