Results 1 to 2 of 2

Thread: RSS and ATOM version support

  1. #1

    Default RSS and ATOM version support

    What is the safe way to support the different RSS and ATOM version? In the below sample I have included media types to support. This seems to be working when I provide different RSS or ATOM feeds.


    // Create a new RestTemplate instance
    RestTemplate restTemplate = new RestTemplate();

    // Configure the SyndFeed message converter.
    SyndFeedHttpMessageConverter syndFeedConverter = new SyndFeedHttpMessageConverter();

    List<MediaType> mediaTypes = new ArrayList<MediaType>();
    mediaTypes.add(MediaType.TEXT_XML);
    mediaTypes.add(MediaType.APPLICATION_ATOM_XML);

    syndFeedConverter.setSupportedMediaTypes(mediaType s);


    // Add the SyndFeed message converter to the RestTemplate instance
    restTemplate.getMessageConverters().add(syndFeedCo nverter);

    // Initiate the request and return the results
    SyndFeed feed = restTemplate.getForObject(url, SyndFeed.class);

  2. #2
    Join Date
    Nov 2010
    Posts
    174

    Default

    The code you provided is correct usage of the SyndFeedHttpMessageConverter. application/rss+xml, and application/atom+xml are the default media (mime) types associated with this converter. You don't need to set these manually, unless you need to support a different type, as you are doing in your code.
    Roy Clarkson
    Spring Mobile Projects Lead

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •