获取请求的Restful Webservice方法

时间:2017-10-18 06:53:23

标签: rest web-services postman get-request getresponse

我正在尝试为get请求编写Web服务方法,其返回类型为ResponseEntity。但是,当我试图从Postman运行它时,它给响应机构不可接受。以下是我的方法的结果和代码。

<html>
    <head>
        <title>Error</title>
    </head>
    <body>Not Acceptable</body>
</html>

代码: -

 @GetMapping("/v1/showMyDetails.html")
 public ResponseEntity tryingGetWithAnnotation(){
     ResponseEntity responseEntity = null;
     JSONObject jsonObj = new JSONObject();
     jsonObj.put("name","nikhil");
     responseEntity = new ResponseEntity(jsonObj,HttpStatus.OK);
     return responseEntity;
 }

先谢谢

0 个答案:

没有答案
相关问题