Search in sources :

Example 6 with Channel

use of com.rometools.rome.feed.rss.Channel in project tutorials by eugenp.

the class ArticleFeedView method newFeed.

protected Channel newFeed() {
    Channel channel = new Channel("rss_2.0");
    channel.setLink("http://localhost:8080/rss");
    channel.setTitle("Article Feed");
    channel.setDescription("Article Feed Description");
    channel.setPubDate(new Date());
    return channel;
}
Also used : Channel(com.rometools.rome.feed.rss.Channel) Date(java.util.Date)

Example 7 with Channel

use of com.rometools.rome.feed.rss.Channel in project tutorials by eugenp.

the class ArticleFeedView method newFeed.

protected Channel newFeed() {
    Channel channel = new Channel("rss_2.0");
    channel.setLink("http://localhost:8080/spring-mvc-simple/rss");
    channel.setTitle("Article Feed");
    channel.setDescription("Article Feed Description");
    channel.setPubDate(new Date());
    return channel;
}
Also used : Channel(com.rometools.rome.feed.rss.Channel) Date(java.util.Date)

Example 8 with Channel

use of com.rometools.rome.feed.rss.Channel in project spring-mvc-showcase by spring-projects.

the class MessageConvertersController method writeChannel.

@GetMapping("/rss")
public Channel writeChannel() {
    Channel channel = new Channel();
    channel.setFeedType("rss_2.0");
    channel.setTitle("My RSS feed");
    channel.setDescription("Description");
    channel.setLink("http://localhost:8080/mvc-showcase/rss");
    return channel;
}
Also used : Channel(com.rometools.rome.feed.rss.Channel) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 9 with Channel

use of com.rometools.rome.feed.rss.Channel in project spring-framework by spring-projects.

the class RssChannelHttpMessageConverterTests method writeOtherContentTypeParameters.

@Test
public void writeOtherContentTypeParameters() throws IOException {
    Channel channel = new Channel("rss_2.0");
    channel.setTitle("title");
    channel.setLink("https://example.com");
    channel.setDescription("description");
    MockHttpOutputMessage message = new MockHttpOutputMessage();
    converter.write(channel, new MediaType("application", "rss+xml", singletonMap("x", "y")), message);
    assertThat(message.getHeaders().getContentType().getParameters()).as("Invalid content-type").hasSize(2).containsEntry("x", "y").containsEntry("charset", "UTF-8");
}
Also used : Channel(com.rometools.rome.feed.rss.Channel) MockHttpOutputMessage(org.springframework.http.MockHttpOutputMessage) MediaType(org.springframework.http.MediaType) Test(org.junit.jupiter.api.Test)

Example 10 with Channel

use of com.rometools.rome.feed.rss.Channel in project spring-framework by spring-projects.

the class RssChannelHttpMessageConverterTests method writeOtherCharset.

@Test
public void writeOtherCharset() throws IOException {
    Channel channel = new Channel("rss_2.0");
    channel.setTitle("title");
    channel.setLink("https://example.com");
    channel.setDescription("description");
    String encoding = "ISO-8859-1";
    channel.setEncoding(encoding);
    Item item1 = new Item();
    item1.setTitle("title1");
    MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
    converter.write(channel, null, outputMessage);
    assertThat(outputMessage.getHeaders().getContentType()).as("Invalid content-type").isEqualTo(new MediaType("application", "rss+xml", Charset.forName(encoding)));
}
Also used : Item(com.rometools.rome.feed.rss.Item) Channel(com.rometools.rome.feed.rss.Channel) MockHttpOutputMessage(org.springframework.http.MockHttpOutputMessage) MediaType(org.springframework.http.MediaType) Test(org.junit.jupiter.api.Test)

Aggregations

Channel (com.rometools.rome.feed.rss.Channel)13 Item (com.rometools.rome.feed.rss.Item)6 Date (java.util.Date)5 Test (org.junit.jupiter.api.Test)5 ArrayList (java.util.ArrayList)3 MockHttpOutputMessage (org.springframework.http.MockHttpOutputMessage)3 MediaType (org.springframework.http.MediaType)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 Book (com.aidanwhiteley.books.domain.Book)1 Content (com.rometools.rome.feed.rss.Content)1 Description (com.rometools.rome.feed.rss.Description)1 Guid (com.rometools.rome.feed.rss.Guid)1 SyndFeed (com.rometools.rome.feed.synd.SyndFeed)1 SyndFeedInput (com.rometools.rome.io.SyndFeedInput)1 XmlReader (com.rometools.rome.io.XmlReader)1 InputStream (java.io.InputStream)1 ZonedDateTime (java.time.ZonedDateTime)1 Test (org.junit.Test)1 PageRequest (org.springframework.data.domain.PageRequest)1 MockHttpInputMessage (org.springframework.http.MockHttpInputMessage)1