我正在尝试在 Web 应用程序(REST、Spring、JPA Hibernate)中返回一个布尔值作为 HTTP 响应。这是代码:
@ResponseBody
@RequestMapping(value="/movieTheater", method=RequestMethod.GET)
public boolean getCustomerInput(Map<String, Double> input) {
return transactionService.addTransaction(input);
}
现在,我想这不允许我返回一个布尔值,而是期待别的东西。当我尝试在浏览器中访问以下内容时:
http://localhost:8081/SpringMVCMerchant/movieTheater.htm
我收到以下错误:
HTTP Status 406 -
type Status report
message
description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
你能告诉我一种发送布尔值作为响应的方法吗?如果没有,我还能做什么?提前致谢!