我的客户应该收到来自控制器的文件。问题是客户端只接收一个字符串。如何从 Controller 获取返回的流?
这是我的控制器:
@Get("/{databaseName}")
MutableHttpResponse < Object > createDatabaseBackup(String databaseName) {
InputStream inputStreamDatabaseBackup = backupTask.exportBackup(databaseName);
return HttpResponse.ok(new StreamedFile(inputStreamDatabaseBackup, MediaType.APPLICATION_OCTET_STREAM_TYPE));
}
这是我的客户:
@Inject
@Client("${agent.connection-url}")
private RxHttpClient client;
public String getBackup(String dataBaseName) {
return client.toBlocking().retrieve(HttpRequest.GET("/backup/" + dataBaseName));
}