LoginSignup
0
0

JAX-RSのStreamingOutputをロジックに依存させない

Posted at

大きいデータをレスポンスに流すときに便利なStreamingOutputだが、適当に使うとロジックに入り込んで後々取り扱いずらくなる。

Consumer<OutputStream> output = logic.execute();
StreamingOutput streamingOutput = output::accept;
return Response.ok().entitiy(streamingOutput).build();

のように実装することにした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0