大きいデータをレスポンスに流すときに便利なStreamingOutputだが、適当に使うとロジックに入り込んで後々取り扱いずらくなる。
Consumer<OutputStream> output = logic.execute();
StreamingOutput streamingOutput = output::accept;
return Response.ok().entitiy(streamingOutput).build();
のように実装することにした。
大きいデータをレスポンスに流すときに便利なStreamingOutputだが、適当に使うとロジックに入り込んで後々取り扱いずらくなる。
Consumer<OutputStream> output = logic.execute();
StreamingOutput streamingOutput = output::accept;
return Response.ok().entitiy(streamingOutput).build();
のように実装することにした。
Register as a new user and use Qiita more conveniently