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

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

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

Feed.setTitle介绍

[英]Sets the feed title.
[中]设置提要标题。

代码示例

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

@Override
protected void buildFeedMetadata(Map<String, Object>model, Feed feed, HttpServletRequest request) {
  feed.setTitle("Test Feed");
}

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

@Test
public void writeOtherCharset() throws IOException, SAXException {
  Feed feed = new Feed("atom_1.0");
  feed.setTitle("title");
  String encoding = "ISO-8859-1";
  feed.setEncoding(encoding);
  MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
  converter.write(feed, null, outputMessage);
  assertEquals("Invalid content-type", new MediaType("application", "atom+xml", Charset.forName(encoding)),
      outputMessage.getHeaders().getContentType());
}

代码示例来源: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: arnaldop/enhanced-pet-clinic

@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
  feed.setId("tag:springsource.org");
  feed.setTitle("Veterinarians");
  feed.setUpdated(new Date());
}

代码示例来源:origin: mploed/event-driven-spring-boot

@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
  feed.setId("https://github.com/mploed/event-driven-spring-boot/credit-decision");
  feed.setTitle("Approved Credit Applications");
  List<Link> alternateLinks = new ArrayList<>();
  Link link = new Link();
  link.setRel("self");
  link.setHref(baseUrl(request) + "feed");
  alternateLinks.add(link);
  List<SyndPerson> authors = new ArrayList<SyndPerson>();
  Person person = new Person();
  person.setName("Big Pug Bank");
  authors.add(person);
  feed.setAuthors(authors);
  feed.setAlternateLinks(alternateLinks);
  feed.setUpdated(decisionMemoRepository.lastUpdate());
  Content subtitle = new Content();
  subtitle.setValue("List of all APPROVED credit applications");
  feed.setSubtitle(subtitle);
}

代码示例来源:origin: mploed/event-driven-spring-boot

@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
  feed.setId("https://github.com/mploed/event-driven-spring-boot/customer");
  feed.setTitle("Customer");
  List<Link> alternateLinks = new ArrayList<>();
  Link link = new Link();
  link.setRel("self");
  link.setHref(baseUrl(request) + "feed");
  alternateLinks.add(link);
  List<SyndPerson> authors = new ArrayList<SyndPerson>();
  Person person = new Person();
  person.setName("Big Pug Bank");
  authors.add(person);
  feed.setAuthors(authors);
  feed.setAlternateLinks(alternateLinks);
  feed.setUpdated(customerRepository.lastUpdate());
  Content subtitle = new Content();
  subtitle.setValue("List of all customers");
  feed.setSubtitle(subtitle);
}

代码示例来源:origin: mploed/ddd-with-spring

@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
  feed.setId("https://github.com/mploed/ddd-with-spring/credit-agency");
  feed.setTitle("Credit Agency Ratings");
  List<Link> alternateLinks = new ArrayList<>();
  Link link = new Link();
  link.setRel("self");
  link.setHref(baseUrl(request) + "feed");
  alternateLinks.add(link);
  List<SyndPerson> authors = new ArrayList<SyndPerson>();
  Person person = new Person();
  person.setName("Big Pug Bank");
  authors.add(person);
  feed.setAuthors(authors);
  feed.setAlternateLinks(alternateLinks);
  feed.setUpdated(personRatingRepository.lastUpdate());
  Content subtitle = new Content();
  subtitle.setValue("List of all valid person ratings");
  feed.setSubtitle(subtitle);
}

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

feed.setId(atomURL
  +"/"+website.getHandle() + "/resources/" + path + start);                
feed.setTitle(website.getName());

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

private InputStream createDefaultFeedDocument(final String uri) throws AtomException {
  final Feed f = new Feed();
  f.setTitle("Feed");
  f.setId(uri);
  f.setFeedType(FEED_TYPE);
  final Link selfLink = new Link();
  selfLink.setRel("self");
  selfLink.setHref(uri);
  f.getOtherLinks().add(selfLink);
  try {
    final WireFeedOutput wireFeedOutput = new WireFeedOutput();
    final Document feedDoc = wireFeedOutput.outputJDom(f);
    final XMLOutputter outputter = new XMLOutputter();
    // outputter.setFormat(Format.getCompactFormat());
    final OutputStream fos = FileStore.getFileStore().getFileOutputStream(getFeedPath());
    outputter.output(feedDoc, new OutputStreamWriter(fos, "UTF-8"));
  } catch (final FeedException ex) {
    throw new AtomException(ex);
  } catch (final IOException ex) {
    throw new AtomException(ex);
  } catch (final Exception e) {
    e.printStackTrace();
  }
  return FileStore.getFileStore().getFileInputStream(getFeedPath());
}

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

feed.setId(atomURL
  +"/"+website.getHandle() + "/entries/" + start);
feed.setTitle(website.getName());

相关文章