返回ResponseEntity的字符串数组

时间:2019-08-07 19:11:48

标签: spring-boot resttemplate

我想将字符串数组中的每个元素显示为单独的一行而不是列表。如何在其余模板中做到这一点?

String[] redisStringArray = redisList.stream().toArray(String[]::new);
return new ResponseEntity<Object>(redisStringArray, HttpStatus.ACCEPTED);

我的响应网页如下:

["promhttp_metric_handler_requests_total{code=\"503\"} 0","promhttp_metric_handler_requests_total{code=\"500\"} 0","promhttp_metric_handler_requests_total{code=\"200\"} 769","# TYPE promhttp_metric_handler_requests_total counter","# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.","promhttp_metric_handler_requests_in_flight 1"]

相反,我想显示如下数据:

promhttp_metric_handler_requests_total{code=\"503\"} 0
promhttp_metric_handler_requests_total{code=\"500\"} 0
promhttp_metric_handler_requests_total{code=\"200\"} 769
# TYPE promhttp_metric_handler_requests_total counter
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
promhttp_metric_handler_requests_in_flight 1

0 个答案:

没有答案