Here I have written this code for a rest web service
in Spring Controllor Class . After build the project I try to use this service
using a Restful-Client
RestService Code :-
@RequestMapping(value="/someurl/{prm_passPhraseCode}/{prm_email}", method= RequestMethod.POST)
public @ResponseBody User sendResetLink(@PathVariable("prm_passPhraseCode") String prm_sPassPhrase, @PathVariable("prm_email") String prm_sEmail , HttpServletRequest prm_ObjRequest, HttpServletResponse prm_ObjResponse){
......
..... //some more logical Code.
return new User(); //just dummy object for reference.
}
Here how I tried to access the Url. I have selected the method type as post
. I have also added two headers
Content-Type : application/json
Accept : application/json
URL http://127.0.0.1:8080/webservice.staff.backend/someurl/23812397997713/kumarvikrant625@gmail.com
Although all my other Rest services urls either it is GET
or POST
are working fine. I have also try by change the method = RequestMethod.GET
but still get the same error.
Error :-
Status Code 406 : The resource identified by this request is only capable of
generating responses with characteristics not acceptable according to the request "accept" headers.
please help if any one have a Idea.
您的网址映射不正确,您缺少sendResetPasswordLink
@RequestMapping(value="/someurl/sendResetPasswordLink/{prm_passPhraseCode}/{prm_email}", method= RequestMethod.POST)
试试这个。。也许可以用...
@RequestMapping(value="/someurl/{prm_passPhraseCode}/{prm_email}",headers="Accept=*/*", method= RequestMethod.POST)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.