Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Rest API  RSS feed

 
Geetha Ganesh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Anyone could you please explain me how to implement the Rest API which is like "http://localhost:8080/www.example.com/{ping}/{hello}". And how to implement in Java where the class extends ServerResource.

Regards,
Geetha.
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to implement everything in java/jee from scratch or use a framework (say spring) to do much of your work?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that REST is an architectural style based on correct use of HTTP methods, not an API.

Various toolkits have been created to implement the REST style - these toolkits have APIs. You do not have to use any toolkit to implement a RESTful service - the standard library is sufficient.


The web services FAQ page here at the ranch includes links to all sorts of REST and SOAP related resources.

Bill
 
Geetha Ganesh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Arun Kumarr: I am not using any framework like Spring. I have to implement from the scratch.
 
Geetha Ganesh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@William Brogden: Thank you William. I am not aware of this type of tool kits. Can you please explain me briefly about the tool kits? I will go through the link that you have attached.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To implement from scratch, look at the methods in the HttpServletRequest interface, such as getContextPath.

These methods let you take apart the URI and other parts of a request to get the resource your request is addressing.

I am not up to date on current toolkits such as Jersey - perhaps another user can help.

Bill
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try starting from here.
 
Junilu Lacar
Sheriff
Posts: 10879
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Geetha Ganesh wrote:
Anyone could you please explain me how to implement the Rest API which is like "http://localhost:8080/www.example.com/{ping}/{hello}". And how to implement in Java where the class extends ServerResource

On top of what Bill already mentioned, pleeeease read http://restcookbook.com/Miscellaneous/richardsonmaturitymodel/ so you are at least aware that you're probably creating or being asked to create something that's at Level 0 of the Richardson Maturity Model, the lowest level.

This probably ranks second on my list of peeves related to calling something a name that it really isn't, right behind folks calling their process "Agile" when it really isn't.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!