Tuesday, September 9, 2014

Problem in getting post parameter in Spring MVC via REST request

@RequestMapping(value = "/api/login", method = RequestMethod.POST)
    public WelcomeMessage getHelloWorld(@RequestParam(value = "username") final String username, @RequestParam(value = "password") final String password) {
            // do some thing
    }


I was having the problem to get post parameter via REST request.  Adding the header "Content-Type:application/x-www-form-urlencoded" fixed the issue