private Response generateBinaryDataResponse(JobId jobId, Optional<BinaryData> maybeBinaryData) {
if (maybeBinaryData.isPresent()) {
final BinaryData binaryData = maybeBinaryData.get();
final StreamingOutput body = outputStream -> {
IOUtils.copyLarge(binaryData.getData(), outputStream);
binaryData.getData().close();
};
final Response.ResponseBuilder b =
Response.ok(body, binaryData.getMimeType())
.header("Content-Length", binaryData.getSizeOf());
if (binaryData.getSizeOf() > Constants.MAX_JOB_OUTPUT_SIZE_IN_BYTES_BEFORE_DISABLING_COMPRESSION)
b.header("Content-Encoding", "identity");
return b.build();
} else {
return Response.status(404).build();
}
}
JobResource.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:jobson
作者:
评论列表
文章目录