• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to read Atom feed using Spring RestTemplate

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am bit confuse regarding best way to read the ATOM feed using spring "Rest Template". Right now, I am passing the respective url and parameter to and get the response as Source.class. Though I am getting the response correct (same as when I invoke same url in browser) is it right way to read the ATOM feed ?

Below is my spring context configuration for RestTemplate,


Regards,
Nitesh
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I mean it works but why not have a look at org.springframework.http.converter.feed.AtomFeedHttpMessageConverter rather than using the SourceHttpMessageConverter
 
Nitesh Patel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bin,
Thanks for the reply. Can you please tell me how can I use AtomFeedHttpMessageConverter? Is it only replacing SourceHttpMessageConverter with AtomFeedHttpMessageConverter

What should be my responseType ?

Thanks,
Nitesh
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Response type should be assignable to com.sun.syndication.feed.atom.Feed.

By default it will read and write "application/atom+xml" unless overridden.

Make sure you have Rome on the classpath
 
Nitesh Patel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,

After setting responseType, I will get feed response as com.sun.syndication.feed.atom.Feed, how can I use to convert to other XML form using XSLT. Currently I am using DOMSource as responseType, use java transform mechanism to transform it to other XML format using .xsl file.

Is there any documentation/tutorial available for this ?


Thanks & Regards,
Nitesh
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick google search returned this tutorial http://www.ibm.com/developerworks/web/library/wa-restful/ .

I guess I am not exactly sure what your requirements are or why you need to perform any type of transformation on the XML. Depending on the requirements perhaps what you have is the best bet, I was just giving you an alternative for handling ATOM feeds, its hard to say more without knowing more about the context.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic