Spring Restful Service

package net.javaonline.spring.restful.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/hello")
public class HelloWorldService {

@RequestMapping
    public String helloMethod1(@RequestParam(value="name", defaultValue="World") String name) {
     
     return   "Hello  "+ name;
    }
 
@RequestMapping(value = "/{firstName}/{lastName}", method = RequestMethod.GET)
    public String helloMethod2(@PathVariable String firstName, @PathVariable String lastName) {
    return "Hello "+ firstName + " " + lastName;
    }  
 
}


servlet
servlet-namerest/servlet-name
servlet-class
org.springframework.web.servlet.DispatcherServlet
/servlet-class
load-on-startup1/load-on-startup
/servlet

Comments

Popular posts from this blog

தீபம் பிளக்ஸ்

தட்டு வண்டியில் காளிக்கோயில் - சிறுகதை

காது புடி வாத்தியார்