码迷,mamicode.com
首页 > 编程语言 > 详细

Spring MVC 在线预览

时间:2020-05-20 16:00:42      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:cat   row   ret   tps   post   res   cte   gre   在线   

/**
     * 合同URL转换-空白合同(服务器加了白名单)
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "/yunji/agreement/get_template", method = RequestMethod.GET)
    public void get_template(String s, HttpServletResponse response) {
        String path = formsOpenapiConfig.getZd_post_url()+"api/v1/yunji/agreement/get_template?s="+s;
        try {
            byte[] html = yunJiService.createHtml(path);
            response.setContentType("text/html;charset=UTF-8");
            response.setCharacterEncoding("utf-8");
            response.getWriter().write(new String(html));
        } catch (IOException e) {
            e.printStackTrace();
        }
        response.setStatus(HttpServletResponse.SC_OK);
    }

    /**
     * 合同URL转换-PDF(服务器加了白名单)
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "/link", method = RequestMethod.GET)
    public void link(String s, HttpServletResponse response) {
        String path = formsOpenapiConfig.getZd_post_url()+"api/v1/link?s="+s;
        try {
            byte[] html = yunJiService.createHtml(path);
            response.setContentType("application/pdf;charset=UTF-8");
            response.setCharacterEncoding("utf-8");
            response.getOutputStream().write(html);
        } catch (IOException e) {
            e.printStackTrace();
        }
        response.setStatus(HttpServletResponse.SC_OK);
    }

 

Spring MVC 在线预览

标签:cat   row   ret   tps   post   res   cte   gre   在线   

原文地址:https://www.cnblogs.com/houyl/p/12923965.html

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