Package net.baguajie.domains

Examples of net.baguajie.domains.Resource


  public void viewSpot(@PathVariable String id,
      Model model, HttpServletRequest request,
      HttpServletResponse response,
      HttpSession session){
    try {
      Resource resource = resourceRepository.getByResId(id);
      if (resource != null) {
        String mime = context.getMimeType(
            "mock." + resource.getExt());
        response.setContentType(mime != null ? mime : "image/jpeg");
      }
      ServletOutputStream os = response.getOutputStream();
      imageService.get(id, os);
    } catch (IOException e) {
View Full Code Here


  public void viewAvatar(@PathVariable String id,
      Model model, HttpServletRequest request,
      HttpServletResponse response,
      HttpSession session){
    try {
      Resource resource = resourceRepository.getByResId(id);
      if (resource != null) {
        String mime = context.getMimeType(
            "mock." + resource.getExt());
        response.setContentType(mime != null ? mime : "image/jpeg");
      }
      ServletOutputStream os = response.getOutputStream();
      imageService.get(id, os);
    } catch (IOException e) {
View Full Code Here

        ext = FilenameUtils.getExtension(file.getName());
      }
      BufferedImage orgImg = ImageIO.read(file);
      // save original avatar file
      String resId = imageService.put(file);
      Resource res = new Resource();
      res.setOrgSize(new Integer[]{ orgImg.getHeight(), orgImg.getWidth() });
      res.setResId(resId);
      res.setExt(ext);
      resourceRepository.save(res);
      signInUser.setAvatarOrg(res);
      // save avatar file
      BufferedImage avatarImg = orgImg.getSubimage(formBean.getX(),
          formBean.getY(), formBean.getW(), formBean.getH());
      ImageIO.write(avatarImg, ext, file);
      resId = imageService.put(file);
      res = new Resource();
      res.setOrgSize(new Integer[] { avatarImg.getHeight(), avatarImg.getWidth() });
      res.setResId(resId);
      res.setExt(ext);
      resourceRepository.save(res);
      signInUser.setAvatar(res);
      userRepository.save(signInUser);
    } catch (Exception e) {
      return new AjaxResult(AjaxResultCode.EXCEPTION, e.getMessage());
View Full Code Here

    try {
      // get image
      ImageReadyVo ir = webImageUtil
          .prepareImageFromUrl(vo.getImageUrl());
      String resId = imageService.put(ir.getFile());
      Resource res = new Resource();
      res.setOrgSize(ir.getOrgSize());
      res.setResId(resId);
      res.setExt(ir.getExt());
      resourceRepository.save(res);
      spot.setImage(res);
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
View Full Code Here

TOP

Related Classes of net.baguajie.domains.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.