如何返回带有 rest 的布尔值?
2022-09-03 06:52:36
我想提供一种只提供真/假布尔响应的服务。boolean
REST
但以下情况不起作用。为什么?
@RestController
@RequestMapping("/")
public class RestService {
@RequestMapping(value = "/",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public Boolean isValid() {
return true;
}
}
结果:HTTP 406: The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.