Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

REST web services

HI,
I have heard about rest but dont know exactly what it is. I have written a small application which just inserts data into db and you can modify it and query it using an id with db. In  the controller i am having the following methods :

[i]This methods open a new window UI where one can enter some data[/i]
 @RequestMapping(value = "/")
    public String newSnippet(HttpServletResponse response) throws IOException {

[i]This method inserts the data entered by user into Database[/i]

    @RequestMapping(value = "/snippets", method = RequestMethod.POST)
    public void createSnippet(@RequestBody String jsonString, RedirectAttributes redirectAttributes,HttpServletResponse response, HttpServletRequest request) throws IOException {

[i]This we can query data using an id.[/i]
 @RequestMapping(value = "/snippets/{id}", method = RequestMethod.GET)
    public ModelAndView showSnippet(@PathVariable String id) {

[i]This is used to update data in db[/i]
@RequestMapping(value = "/snippets/{id}", method = RequestMethod.PUT)
    public void showSnippet(@RequestBody String jsonString, @PathVariable String id, HttpServletResponse response) {

[i]This is called when user clicks on edit button so he can edit data[/i]
    @RequestMapping(value= "/snippets/{id}/edit", method = RequestMethod.GET)
    public ModelAndView editSnippet(@PathVariable String id){

[i]This displays the user data corresponding to id in a raw form[/i]
@RequestMapping(value="/snippets/{id}/raw", method=RequestMethod.GET)
    @ResponseBody
    public String rawSnippet(@PathVariable String id, HttpServletResponse response){

Open in new window


Are the above in compalince with REST ? If not how do i restify it ?
What exactly is REST and why is it so important ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial