The Artima Developer Community
Sponsored Link

Java Community News
Why Use Atom Publishing Protocol for REST?

2 replies on 1 page. Most recent reply: Aug 26, 2009 4:34 AM by Bala Chandra yadav

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Why Use Atom Publishing Protocol for REST? Posted: Mar 21, 2007 4:01 PM
Reply to this message Reply
Summary
In a recent blog post, Sun's David Van Couvering ponders the best way to expose a RESTful Web service.
Advertisement

As REST is gaining popularity as an interface to Web-based data services, developers are looking for effective ways to implement REST services. Some prefer to expose RESTful URLs as a way to interact with a service. Increasingly, however, service providers wrap a RESTful API into some other format, such as an application-specific API or the more general-purpose Atom Publishing Protocol (APP) format. An example of the latter is Google's GoogleBase API.

In a recent blog post, Why use Atom Publishing Protocol for REST?, Sun's David Van Couvering invites his readers to debate the merits of the Atom-based approach. He quotes several advantages of using Atom for REST:

  • APP lets you post a new entry without having to know its URI. The protocol lets the server tell you where it put it as part of the response. This allows the server to allocate things as it sees fit, and decouples the client and server. This feature also seems key to me for solutions that need to scale—you don't want to hardcode locations into the client.
  • Because APP and Atom are growing and popular standards, lots of products are or will be working with it. As a simple example, when I was testing my Atom server with my browser, at first I was just getting raw XML displayed (through a plugin). But when I finally got the response right and sent a valid Atom feed, all of a sudden Google Reader popped in and asked me if I wanted to subscribe to the feed. Sweet!
  • Because APP and Atom are growing and popular standards, people are providing and will continue to provide tools to make it easy to build APP servers and clients. ROME and Apache Abdera are just two examples of this.

In your experience, what is the best way to expose a RESTful service? Would you use Atom for the reasons Van Couvering mentions in his blog?


Greg Lorriman

Posts: 5
Nickname: ashtray
Registered: Feb, 2004

Re: Why Use Atom Publishing Protocol for REST? Posted: Mar 23, 2007 5:15 AM
Reply to this message Reply
The latter two reasons are not real reasons. They can be summarised as "we should do it because everyone else is doing it".

And I couldn't understand the first reason. I think it might need a little explanation for those of us who don't know much about ATOM.

Bala Chandra yadav

Posts: 1
Nickname: balu22
Registered: Aug, 2009

Re: Why Use Atom Publishing Protocol for REST? Posted: Aug 26, 2009 4:34 AM
Reply to this message Reply
Hello Guys..
I am new to Atom Feeds. So thought of writing a sample feed, but i am struck implementing it. When i am trying to pull the feed content using a servlet, the servlet is just showing the html body content..the code i used to extract the feed is
package Atom;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class FirstTrail extends HttpServlet {
private static final long serialVersionUID = 1L;


public FirstTrail() {
super();

}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

response.setContentType("html/text");
PrintWriter pw = response.getWriter();
pw.println("<html><head>");
pw.println("<link rel=\"alternate\" type=\"application/atom+xml\" href=\"http://localhost:8080/trail.atom\" title=\"First Trail\" />");
pw.println("</head>");
pw.println("<body>Nothing</body>");
pw.println("</html>");

}

Someone Help me...

Flat View: This topic has 2 replies on 1 page
Topic: JIDE Charts Beta Released Previous Topic   Next Topic Topic: Scala's Option Type


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us