Java Code Examples for com.rometools.rome.feed.atom.Feed#setTitle()

The following examples show how to use com.rometools.rome.feed.atom.Feed#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtomFeedView.java    From wallride with Apache License 2.0 6 votes vote down vote up
protected void buildFeedMetadata(
			Map<String, Object> model,
			Feed feed,
			HttpServletRequest request) {
		Blog blog = blogService.getBlogById(Blog.DEFAULT_ID);
		String language = LocaleContextHolder.getLocale().getLanguage();

		feed.setTitle(blog.getTitle(language));
		Content info = new Content();
		info.setValue(blog.getTitle(language));
		feed.setInfo(info);

		ArrayList<Link> links = new ArrayList<>();
		Link link = new Link();
		UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
		link.setHref(builder.buildAndExpand().toUriString());
		links.add(link);
		feed.setOtherLinks(links);
//		feed.setIcon("http://" + settings.getAsString(Setting.Key.SITE_URL) + "resources/default/img/favicon.ico");
	}
 
Example 2
Source File: CustomerAtomFeedView.java    From event-driven-spring-boot with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 3
Source File: OrderAtomFeedView.java    From microservice-atom with Apache License 2.0 6 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
	feed.setId("tag:ewolff.com/microservice-atom/order");
	feed.setTitle("Order");
	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 Money Online Commerce Inc.");
	authors.add(person);
	feed.setAuthors(authors);

	feed.setAlternateLinks(alternateLinks);
	feed.setUpdated(orderRepository.lastUpdate());
	Content subtitle = new Content();
	subtitle.setValue("List of all orders");
	feed.setSubtitle(subtitle);
}
 
Example 4
Source File: AtomFeedHttpMessageConverterTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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));
}
 
Example 5
Source File: FoundEpisodesAtomFeedView.java    From podcastpedia-web with MIT License 5 votes vote down vote up
protected void buildFeedMetadata(Map model, Feed feed, HttpServletRequest request) {
    feed.setId("" + model.get("feed_id"));
    feed.setTitle("" + model.get("feed_title"));
    Content subTitle = new Content();
    subTitle.setValue("" + model.get("feed_description"));
    feed.setSubtitle(subTitle);
}
 
Example 6
Source File: FoundPodcastsAtomFeedView.java    From podcastpedia-web with MIT License 5 votes vote down vote up
protected void buildFeedMetadata(Map model, Feed feed, HttpServletRequest request) {
    feed.setId("" + model.get("feed_id"));
    feed.setTitle("" + model.get("feed_title"));
    Content subTitle = new Content();
    subTitle.setValue("" + model.get("feed_description"));
    feed.setSubtitle(subTitle);
}
 
Example 7
Source File: GenericAtomFeedView.java    From podcastpedia-web with MIT License 5 votes vote down vote up
protected void buildFeedMetadata(Map model, Feed feed, HttpServletRequest request) {
    feed.setId("" + model.get("feed_id"));
    feed.setTitle("" + model.get("feed_title"));
    Content subTitle = new Content();
    subTitle.setValue("" + model.get("feed_description"));
    feed.setSubtitle(subTitle);
}
 
Example 8
Source File: MessageConvertersController.java    From spring-tutorial with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
@RequestMapping(value = "/atom", method = RequestMethod.GET)
public @ResponseBody
Feed writeFeed() {
	Feed feed = new Feed();
	feed.setFeedType("atom_1.0");
	feed.setTitle("My Atom feed");
	return feed;
}
 
Example 9
Source File: AtomFeedHttpMessageConverterTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 10
Source File: AtomFeedHttpMessageConverterTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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<Entry>(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", utf8),
			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>";
	assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
}
 
Example 11
Source File: HrmsAtomViewBuilder.java    From Spring-MVC-Blueprints with MIT License 5 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed,
		HttpServletRequest request) {
	feed.setTitle("User Feeds News");
	feed.setId("tag:hrmsUserTypes");
	feed.setUpdated(new Date());

}
 
Example 12
Source File: AtomFeedHttpMessageConverterTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example 13
Source File: AtomFeedHttpMessageConverterTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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));
}
 
Example 14
Source File: AtomFeedHttpMessageConverterTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example 15
Source File: AtomFeedViewTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
protected void buildFeedMetadata(Map model, Feed feed, HttpServletRequest request) {
	feed.setTitle("Test Feed");
}
 
Example 16
Source File: VetsAtomView.java    From docker-workflow-plugin with MIT License 4 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
    feed.setId("tag:springsource.org");
    feed.setTitle("Veterinarians");
    //feed.setUpdated(date);
}
 
Example 17
Source File: VetsAtomView.java    From audit4j-demo with Apache License 2.0 4 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
    feed.setId("tag:springsource.org");
    feed.setTitle("Veterinarians");
    //feed.setUpdated(date);
}
 
Example 18
Source File: AtomFeedViewTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object>model, Feed feed, HttpServletRequest request) {
	feed.setTitle("Test Feed");
}
 
Example 19
Source File: AtomFeedViewTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object>model, Feed feed, HttpServletRequest request) {
	feed.setTitle("Test Feed");
}
 
Example 20
Source File: VetsAtomView.java    From activejpa with Apache License 2.0 4 votes vote down vote up
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
    feed.setId("tag:springsource.org");
    feed.setTitle("Veterinarians");
    //feed.setUpdated(date);
}