从Spring rest Web服务获得excel下载

时间:2014-08-19 15:40:14

标签: java excel spring rest

我可以从弹簧休息中产生一个excel。你能提供示例代码:

我可以看到我们可以使用http://www.mkyong.com/webservices/jax-rs/download-excel-file-from-jax-rs/

不确定需要在里面写什么代码:

    @RequestMapping(value = "/getexcel", method = RequestMethod.POST, produces="application/vnd.ms-excel")
    public Response getFile() {

    }

由于 RAM

1 个答案:

答案 0 :(得分:0)

一种方式(我通常使用)是读取文件并写入Outputstream(ServletOutputStream)。您需要在参数中包含HTTPServletResponse。

基本上你的getFile()应该有HTTPServletResponse参数,然后在函数代码中写出outputstream.write();