在远程服务器上获取HTTP状态415

时间:2016-04-11 20:11:32

标签: json spring rest spring-mvc

我在开放班次上主持了一个应用程序,现在我遇到了一个奇怪的情况。我有一种方法如下。

@RequestMapping (value = "/saveDetails", method = POST)
@ResponseBody
public User saveUserDetails(@RequestBody User user){
    return userService.addUser(user);
}

现在,当我使用fire fox插件'httpPoster'发布用户对象时,

  

它在localhost上工作正常

enter image description here

  

但在开放式转移服务器上,它返回415代码。

enter image description here

1 个答案:

答案 0 :(得分:0)

I think it should be method = RequesMethod.POST

@RequestMapping(value = "/saveDetails", method = RequestMethod.POST). 

Btw a small suggestion, try not using the verbs to describe the rest services.