码迷,mamicode.com
首页 > 其他好文 > 详细

qiniu

时间:2017-09-03 15:39:21      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:str   new   ring   mapping   app   ppi   byte   body   mvc   

@RestController
public class QiNiuController {

private static final Logger logger = LoggerFactory.getLogger(QiNiuController.class);

@Autowired
QiNiuServiceImpl qiNiuServiceImpl;

/**
* 将spring mvc接收到的图片再上传到七牛上
* @param file
* @param request
* @param response
* @param session
* @return
*/
@ResponseBody
@RequestMapping(value = "/photoUpload", method = RequestMethod.POST)
public String photoUpload(MultipartFile file, HttpServletRequest request, HttpServletResponse response,
HttpSession session) {
String resultURL;
if(null == file){
throw new BusinessException("图片不能为空");
}
try {
resultURL = qiNiuServiceImpl.upload2QiNiu(file);
} catch (IOException e) {
logger.error("图片file转换bytes错误",e);
throw new BusinessException("图片file转换bytes错误");
}
return resultURL;
}
}

qiniu

标签:str   new   ring   mapping   app   ppi   byte   body   mvc   

原文地址:http://www.cnblogs.com/panxuejun/p/7469631.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!