Deal of the Day

Home » Main » Manning Forums » 2009 » Restlet in Action

Thread: Please HELP - I cant understand this concept

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Pages: 1 - Last Post: Oct 1, 2011 11:38 AM by: jerome.louvel
infoSyS

Posts: 2
Registered: 6/7/11
Please HELP - I cant understand this concept
Posted: Jun 19, 2011 7:25 AM
  Click to reply to this thread Reply

There is this thing which I really can't understand about REST's concept.
Suppose I have a resource called Company which has the following attributes : name, address, etc... and another resource called employee with the attributes : name, companyName, etc..

The employeeResource class will implement a method to GET the company name (having the ID identified in the URI) plus the other information ( adrress ... etc )

The employeesResource class will implement a method to GET all the companies names and relevant information

same thing for the employee and employees resource class.

Suppose the client wants to get the name of all employees and the name of the company they work at and its address. so WHERE should the function that performs this query be placed ? and what should be the URI in this case ? here in this case we are not accessing only one resource, but two at the same time as I can understand.

PLEASE can any one help me understand this ?

sithlord

Posts: 49
From: San Diego
Registered: 6/5/10
Re: Please HELP - I cant understand this concept
Posted: Jun 25, 2011 12:25 PM   in response to: infoSyS in response to: infoSyS
  Click to reply to this thread Reply

Hello,

I found this tutorial to be helpful explaining REST. I have called out two sections why may help you with your inquiry.

http://www.ibm.com/developerworks/java/tutorials/j-rest/
http://www.ibm.com/developerworks/java/tutorials/j-rest/section3.html
http://www.ibm.com/developerworks/java/tutorials/j-rest/section5.html

Cheers,
/.Will

thierry.templier

Posts: 16
Registered: 7/7/09
Re: Please HELP - I cant understand this concept
Posted: Jul 29, 2011 7:01 AM   in response to: sithlord in response to: sithlord
  Click to reply to this thread Reply

Hello Will,

I'm not sure to really understand your question.

Regarding the employee list, I think that the corresponding URI could be: http://<HOST>:<PORT>/employees/. The returned representation can contain all the hints you expect such as employee name, the name of the company they work at and their addresses. Something like that if you use XML:

<employees>
<employee>
<firstName>...</firstName>
<lastName>...</lastName>
<company>
<name>...</name>
</company>
<adress>
...
</adress>
</employee>
...
<employee>
...
</employee>
</employees>

The server resource for employee list can handle such request.
Does it answer your question?
Thierry

sithlord

Posts: 49
From: San Diego
Registered: 6/5/10
Re: Please HELP - I cant understand this concept
Posted: Jul 29, 2011 10:13 AM   in response to: thierry.templier in response to: thierry.templier
  Click to reply to this thread Reply

Hello Thierry,

I was not the one asking the question. It was the guy from InfoSys who was asking the question, but thanks for the answer.

Cheers,
/.Will

jerome.louvel

Posts: 133
Registered: 11/4/09
Re: Please HELP - I cant understand this concept
Posted: Oct 1, 2011 11:38 AM   in response to: sithlord in response to: sithlord
  Click to reply to this thread Reply

Hi Will,

That's true, sorry for the confusion :) Thanks for your active presence and help in this forum!

BTW, the new MEAP release is coming early next week.

Best regards,
Jerome

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor