IOUtils.closeQuietly();

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ZHOU_VIP/article/details/89383322
@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.csdn.net/huanghanqian/article/details/82500132

猜你喜欢

转载自blog.csdn.net/ZHOU_VIP/article/details/89383322