@RequestMapping("/getoplogphotoimg")
@ResponseBody
public String getoplogphotoimg(HttpServletRequest request, HttpServletResponse response) throws Exception{
String photoId = request.getParameter("photoid");
OutputStream out = null;
try {
InspectOpLogPhoto photo = this.opLogService.queryOpLogPhotoData(photoId);
if (photo == null){
return null;
}
response.setContentType(ImageUtils.getImageContentType(photo.getImagetype(), ImageUtils.DEFAULT_IMAGE_CONTENTTYPE));
out = response.getOutputStream();
out.write(photo.getPhoto());
out.flush();
} catch(Exception e){
logger.error("getoplogphotoimg failed: "+photoId, e);
} finally {
IOUtils.closeQuietly(out);
}
return null;
}
https://blog.youkuaiyun.com/huanghanqian/article/details/82500132
本文介绍了一个用于从服务器获取操作日志中图片的RESTful API实现。该API通过接收图片ID参数,从数据库查询对应的操作日志图片数据,设置响应内容类型为图片格式,并将图片数据写入HTTP响应输出流中返回给客户端。
1079

被折叠的 条评论
为什么被折叠?



