Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why we are using atoms in rest?

I've seen many times xml in rest web services, having the following format:

<author>
   <atom:link rel="author" type="application/xml" href="http://www.../author/1"/>
</author>

and the url (http://www.../author/1) will contain something like this:

<author xmlns="http://www.../ckp" xmlns:atom="http://www.w3.org/2005/atom">
  <name>S. Crocker</name>
  <address>None</address>
  <affiliation></affiliation>
  <email>None</email>
</author>
  1. I was wondering why the first form of xml is being used?
  2. How can these be modeled on a java model class (using the mvc pattern)?
like image 699
Alex Dowining Avatar asked May 05 '12 19:05

Alex Dowining


1 Answers

The answer to your first question is simple: ATOM is a solid standard that covers a bunch of standard things that you want to do for publishing, updating, and otherwise managing information.

So, people use ATOM for the same reason they use HTTP - they could invest something unique, but the standard gives them better tools.

To the second, various Java libraries exist, but there is no definitive way to do this. Everything from "write your own model objects and hand-parse the XML" through to the sort of "do it for you" libraries that question links to will work just fine.

like image 100
Daniel Pittman Avatar answered Oct 01 '22 02:10

Daniel Pittman