DocumentService.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:document-management-system 作者:
@GET
@Path("/getContent")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getContent(@QueryParam("docId") String docId) throws GenericException {
    try {
        log.debug("getContent({})", new Object[]{docId});
        DocumentModule dm = ModuleManager.getDocumentModule();
        final InputStream is = dm.getContent(null, docId, false);
        StreamingOutput stream = new StreamingOutput() {
            @Override
            public void write(OutputStream os) throws IOException, WebApplicationException {
                IOUtils.copy(is, os);
                IOUtils.closeQuietly(is);
                IOUtils.closeQuietly(os);
            }
        };

        log.debug("getContent: [BINARY]");
        return Response.ok(stream).build();
    } catch (Exception e) {
        throw new GenericException(e);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号