com.rometools.rome.feed.atom.Feed.setEntries()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中com.rometools.rome.feed.atom.Feed.setEntries()方法的一些代码示例,展示了Feed.setEntries()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feed.setEntries()方法的具体详情如下:
包路径:com.rometools.rome.feed.atom.Feed
类名称:Feed
方法名:setEntries

Feed.setEntries介绍

[英]Sets the feed entries.
[中]设置提要条目。

代码示例

代码示例来源:origin: spring-projects/spring-framework

/**
 * Invokes {@link #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse)}
 * to get a list of feed entries.
 */
@Override
protected final void buildFeedEntries(Map<String, Object> model, Feed feed,
    HttpServletRequest request, HttpServletResponse response) throws Exception {
  List<Entry> entries = buildFeedEntries(model, request, response);
  feed.setEntries(entries);
}

代码示例来源:origin: org.springframework/spring-webmvc

/**
 * Invokes {@link #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse)}
 * to get a list of feed entries.
 */
@Override
protected final void buildFeedEntries(Map<String, Object> model, Feed feed,
    HttpServletRequest request, HttpServletResponse response) throws Exception {
  List<Entry> entries = buildFeedEntries(model, request, response);
  feed.setEntries(entries);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void write() throws IOException, SAXException {
  Feed feed = new Feed("atom_1.0");
  feed.setTitle("title");
  Entry entry1 = new Entry();
  entry1.setId("id1");
  entry1.setTitle("title1");
  Entry entry2 = new Entry();
  entry2.setId("id2");
  entry2.setTitle("title2");
  List<Entry> entries = new ArrayList<>(2);
  entries.add(entry1);
  entries.add(entry2);
  feed.setEntries(entries);
  MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
  converter.write(feed, null, outputMessage);
  assertEquals("Invalid content-type", new MediaType("application", "atom+xml", StandardCharsets.UTF_8),
      outputMessage.getHeaders().getContentType());
  String expected = "<feed xmlns=\"http://www.w3.org/2005/Atom\">" + "<title>title</title>" +
      "<entry><id>id1</id><title>title1</title></entry>" +
      "<entry><id>id2</id><title>title2</title></entry></feed>";
  NodeMatcher nm = new DefaultNodeMatcher(ElementSelectors.byName);
  assertThat(outputMessage.getBodyAsString(StandardCharsets.UTF_8),
      isSimilarTo(expected).ignoreWhitespace().withNodeMatcher(nm));
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Invokes {@link #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse)}
 * to get a list of feed entries.
 */
@Override
protected final void buildFeedEntries(Map<String, Object> model, Feed feed,
    HttpServletRequest request, HttpServletResponse response) throws Exception {
  List<Entry> entries = buildFeedEntries(model, request, response);
  feed.setEntries(entries);
}

代码示例来源:origin: rometools/rome

/**
 * Utility method to serialize an entry to writer.
 */
public static void serializeEntry(final Entry entry, final Writer writer) throws IllegalArgumentException, FeedException, IOException {
  // Build a feed containing only the entry
  final List<Entry> entries = new ArrayList<Entry>();
  entries.add(entry);
  final Feed feed1 = new Feed();
  feed1.setFeedType("atom_1.0");
  feed1.setEntries(entries);
  // Get Rome to output feed as a JDOM document
  final WireFeedOutput wireFeedOutput = new WireFeedOutput();
  final Document feedDoc = wireFeedOutput.outputJDom(feed1);
  // Grab entry element from feed and get JDOM to serialize it
  final Element entryElement = feedDoc.getRootElement().getChildren().get(0);
  final XMLOutputter outputter = new XMLOutputter();
  outputter.output(entryElement, writer);
}

代码示例来源:origin: com.rometools/rome

/**
 * Utility method to serialize an entry to writer.
 */
public static void serializeEntry(final Entry entry, final Writer writer) throws IllegalArgumentException, FeedException, IOException {
  // Build a feed containing only the entry
  final List<Entry> entries = new ArrayList<Entry>();
  entries.add(entry);
  final Feed feed1 = new Feed();
  feed1.setFeedType("atom_1.0");
  feed1.setEntries(entries);
  // Get Rome to output feed as a JDOM document
  final WireFeedOutput wireFeedOutput = new WireFeedOutput();
  final Document feedDoc = wireFeedOutput.outputJDom(feed1);
  // Grab entry element from feed and get JDOM to serialize it
  final Element entryElement = feedDoc.getRootElement().getChildren().get(0);
  final XMLOutputter outputter = new XMLOutputter();
  outputter.output(entryElement, writer);
}

代码示例来源:origin: apache/roller

feed.setEntries(atomEntries);

代码示例来源:origin: rometools/rome

protected WireFeed parseFeed(final Element eFeed, final Locale locale) throws FeedException {
  String baseURI = null;
  try {
    baseURI = findBaseURI(eFeed);
  } catch (final Exception e) {
    throw new FeedException("ERROR while finding base URI of feed", e);
  }
  final Feed feed = parseFeedMetadata(baseURI, eFeed, locale);
  feed.setStyleSheet(getStyleSheet(eFeed.getDocument()));
  final String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE);
  if (xmlBase != null) {
    feed.setXmlBase(xmlBase);
  }
  feed.setModules(parseFeedModules(eFeed, locale));
  final List<Element> eList = eFeed.getChildren("entry", getAtomNamespace());
  if (!eList.isEmpty()) {
    feed.setEntries(parseEntries(feed, baseURI, eList, locale));
  }
  final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace());
  if (!foreignMarkup.isEmpty()) {
    feed.setForeignMarkup(foreignMarkup);
  }
  return feed;
}

代码示例来源:origin: com.rometools/rome

protected WireFeed parseFeed(final Element eFeed, final Locale locale) throws FeedException {
  String baseURI = null;
  try {
    baseURI = findBaseURI(eFeed);
  } catch (final Exception e) {
    throw new FeedException("ERROR while finding base URI of feed", e);
  }
  final Feed feed = parseFeedMetadata(baseURI, eFeed, locale);
  feed.setStyleSheet(getStyleSheet(eFeed.getDocument()));
  final String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE);
  if (xmlBase != null) {
    feed.setXmlBase(xmlBase);
  }
  feed.setModules(parseFeedModules(eFeed, locale));
  final List<Element> eList = eFeed.getChildren("entry", getAtomNamespace());
  if (!eList.isEmpty()) {
    feed.setEntries(parseEntries(feed, baseURI, eList, locale));
  }
  final List<Element> foreignMarkup = extractForeignMarkup(eFeed, feed, getAtomNamespace());
  if (!foreignMarkup.isEmpty()) {
    feed.setForeignMarkup(foreignMarkup);
  }
  return feed;
}

代码示例来源:origin: apache/roller

feed.setEntries(atomEntries);

代码示例来源:origin: com.rometools/rome

aFeed.setEntries(createAtomEntries(sEntries));

代码示例来源:origin: rometools/rome

aFeed.setEntries(createAtomEntries(sEntries));

代码示例来源:origin: rometools/rome

aFeed.setEntries(createAtomEntries(sEntries));

代码示例来源:origin: com.rometools/rome

aFeed.setEntries(createAtomEntries(sEntries));

代码示例来源:origin: rometools/rome

feed.setEntries(parseEntries(entries, locale));

代码示例来源:origin: com.rometools/rome

feed.setEntries(parseEntries(entries, locale));

相关文章