use of org.springframework.web.bind.annotation.ResponseBody in project topcom-cloud by 545314690.
the class ServiceController method verifyCode.
@RequestMapping(method = RequestMethod.GET, value = "verifyCode")
@ResponseBody
public String verifyCode(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// 设置响应头信息,告诉浏览器不要缓存此内容
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expire", 0);
/**
* 加上这个前台ajax才能获得自定义的header
* response.setHeader("Access-Control-Expose-Headers", "custom header");
* response.setHeader("costum header", "custom header value");
*/
response.setHeader("Access-Control-Expose-Headers", codeHeader);
String code = UUID.randomUUID().toString();
response.setHeader(codeHeader, code);
RandomVerifyCode randomVerifyCode = new RandomVerifyCode();
try {
// 输出图片方法
RandomVerifyCode.VerifyCode verifyCode = randomVerifyCode.getBase64Randcode();
if (verifyCode != null) {
SubjectUtil.setCaptcha(code, verifyCode.code);
return verifyCode.image;
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
use of org.springframework.web.bind.annotation.ResponseBody in project topcom-cloud by 545314690.
the class CollectionController method isCollected.
/**
* 根据输入,返回分页结果中的当前页,包括当前页信息和其中的实体对象集合
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/isCollected.json", method = RequestMethod.GET, produces = "application/json")
@ResponseBody
public boolean isCollected(HttpServletRequest request, HttpServletResponse response, String oId) {
boolean isCollected = false;
Collection collection = this.collectionManager.findByOId(oId);
if (collection != null) {
isCollected = true;
}
return isCollected;
}
use of org.springframework.web.bind.annotation.ResponseBody in project pmph by BCSquad.
the class BookUserCommentController method list.
/**
* 功能描述:分页初始化/模糊查询图书评论
*
* @param pageSize
* 当页的数据条数
* @param pageNumber
* 当前页码
* @param name
* 数据名称/isbn
* @param isAuth
* 是否通过审核
* @return
*/
@ResponseBody
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "分页初始化/模糊查询图书评论")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ResponseBean list(Integer pageSize, Integer pageNumber, String name, Integer isAuth, Boolean isLong) {
PageParameter<BookUserCommentVO> pageParameter = new PageParameter<>(pageNumber, pageSize);
BookUserCommentVO bookUserCommentVO = new BookUserCommentVO();
bookUserCommentVO.setIsAuth(isAuth);
// 去除空格
bookUserCommentVO.setName(name.replaceAll(" ", ""));
bookUserCommentVO.setIsLong(isLong);
pageParameter.setParameter(bookUserCommentVO);
return new ResponseBean(bookUserCommentService.listBookUserComment(pageParameter));
}
use of org.springframework.web.bind.annotation.ResponseBody in project pmph by BCSquad.
the class BookVideoController method addVideo.
@ResponseBody
@RequestMapping(value = "/addVideo", method = RequestMethod.POST)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "保存微视频信息")
public ResponseBean<Integer> addVideo(Long userId, Long bookId, String title, String origPath, String origFileName, Long origFileSize, String path, String fileName, Long fileSize, @RequestParam("cover") MultipartFile cover) throws IOException {
BookVideo bookVideo = new BookVideo();
bookVideo.setBookId(bookId);
bookVideo.setTitle(title);
bookVideo.setOrigPath(origPath);
bookVideo.setOrigFileName(origFileName);
bookVideo.setOrigFileSize(origFileSize);
bookVideo.setPath(path);
bookVideo.setFileName(fileName);
bookVideo.setFileSize(fileSize);
return new ResponseBean(bookVideoService.addBookVideoFront(userId, bookVideo, cover));
}
use of org.springframework.web.bind.annotation.ResponseBody in project pmph by BCSquad.
the class BookVideoController method addBookVideo.
/**
* 保存视频
*
* @param request
* @param cover
* @throws java.io.IOException
* @introduction
* @author Mryang
* @createDate 2018年2月10日 下午5:34:12
* @return
*/
@ResponseBody
@RequestMapping(value = "/addBookVideo", method = RequestMethod.POST)
@LogDetail(businessType = BUSSINESS_TYPE, logRemark = "保存微视频信息")
public ResponseBean<Integer> addBookVideo(HttpServletRequest request, Long bookId, String title, String origPath, String origFileName, Long origFileSize, String path, String fileName, Long fileSize, @RequestParam("cover") MultipartFile cover) throws IOException {
String sessionId = CookiesUtil.getSessionId(request);
if (StringUtil.isEmpty(sessionId)) {
return new ResponseBean(new CheckedServiceException(CheckedExceptionBusiness.BOOK_VEDIO, CheckedExceptionResult.USER_SESSION, "尚未登录或session已过期"));
}
BookVideo bookVideo = new BookVideo();
bookVideo.setBookId(bookId);
bookVideo.setTitle(title);
bookVideo.setOrigPath(origPath);
bookVideo.setOrigFileName(origFileName);
bookVideo.setOrigFileSize(origFileSize);
bookVideo.setPath(path);
bookVideo.setFileName(fileName);
bookVideo.setFileSize(fileSize);
return new ResponseBean(bookVideoService.addBookVideo(sessionId, bookVideo, cover));
}
Aggregations