开发者

Java API design for RESTful application

开发者 https://www.devze.com 2023-04-08 00:03 出处:网络
I need to design a RESTful application which allows me to access the people’s contact information from Facebook.

I need to design a RESTful application which allows me to access the people’s contact information from Facebook.

I stored the First name, last name, email address in the database. For the UI I will use Dojo to display the data.

But I don’t know how to design the middle layer to retrieve the data and how to pass it to the Dojo/javascript.

I have done J2EE development and used Struts framework. I know in J2EE, I can create ent开发者_StackOverflowities beans, and then pass the information to the UI layer through the session beans.

But in a RESTful application, what type of classes do I need to use to accomplish what the entities and session beans can do?

Are there any books that can help me get up to speed ASAP?


I have done this quite rapidly (although I think that there are better ways) with the following steps:

  1. Created the RESTful web services from db using NetBeans's wizard: http://netbeans.org/kb/docs/websvc/rest.html
  2. In Dojo, I have used dojo.xhrGet specifing the url of the service, handleAs: "json"

    dojo.xhrGet({
         url: myURL,
         handleAs: "json",
         headers: {"Content-Type": "application/json; charset=uft-8", "Accept" : "application/json"},
         load: function(responseObject) {
             myList = responseObject;
         }
    });
    
  3. I have read one by one the items in the list and added to a dojo.data.ItemFileWriteStore by using newItem method
  4. I have added the store to a dojox.grid.DataGrid
0

精彩评论

暂无评论...
验证码 换一张
取 消