【发布时间】:2021-01-27 04:22:17
【问题描述】:
我有两个服务返回两个不同的 ResponseEntity。
public ResponseEntity<InputStreamResource> getA(...) {
return ResponseEntity
.ok()
.headers(headers)
.contentType(MediaType.APPLICATION_PDF)
.contentLength(out.size())
.body(new InputStreamResource(bis)); }
public ResponseEntity<InputStreamResource> getB(...) {
return ResponseEntity
.ok()
.headers(headers)
.contentType(MediaType.APPLICATION_PDF)
.contentLength(out.size())
.body(new InputStreamResource(bis)); }
每个服务都有一个调用和返回的控制器。
public ResponseEntity<InputStreamResource> getA(...) {
return aService.getA(...) }
public ResponseEntity<InputStreamResource> getB(...) {
return bService.getB(...) }
我正在尝试创建另一个控制器,它同时执行并返回两个服务。
public ResponseEntity<InputStreamResource> getAB(...) {
return aService.getA(...) *and* bService.getB(...) ?????? }
不确定如何将两个 ResponseEntities 返回合并为一个。
【问题讨论】:
标签: java spring controller