【发布时间】:2016-08-15 12:30:15
【问题描述】:
我写了一个 REST 调用,它会在调用时返回健康状态
@RestController
@RequestMapping(value = "/account")
public class HealthCheckController {
protected final Logger log = LoggerFactory.getLogger(this.getClass());
@RequestMapping(value = "/health", method = RequestMethod.GET, produces = { "application/json" })
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "Returns the health status of the application", notes = "Load balancer user this to confirm the health of the node")
public @ResponseBody String getHealth(HttpServletRequest request, HttpServletResponse response) throws Exception {
log.info("***" + RequestCorrelation.getId() + "***" + "HealthCheckController - getHealth () Called");
return "{\"health\":{\"SERVICES\":\"OK\"}}";
}
}
当我在 swagger 或 postman 中打开它时,它会返回正确的响应。但是当我在 chrome 浏览器中点击这个 URL 时,我看到了
This page contains the following errors:
error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.
为什么会这样?以及如何解决这个问题?
【问题讨论】:
-
嗨,shiva,我也遇到了同样的问题,它在本地工作,但在服务器上它停止了,你能告诉我这个问题与 Apache 服务器有关吗
标签: java rest google-chrome spring-mvc spring-boot