我用下面的例子来测试。 REST Api可以工作,但它会以流格式提供结果。 但是,我期待与文件选项结果。我使用这个例子来嵌入Angular JS框架。在REST服务中设置一个excel文件作为响应
@GET
@Path("/get")
@Produces("application/vnd.ms-excel")
public Response getFile() {
LOG.info("get - Function begins from here");
File file = new File("/home/test/file.xls");
ResponseBuilder response = Response.ok((Object) file);
response.header("Content-Disposition",
"attachment; filename=new-excel-file.xls");
response.header("Content-Type","application/octet-stream");
return response.build();
}
**,我发现这里的解决方案,以我的问题 http://stackoverflow.com/questions/22447952/angularjs-http-post-convert-binary-to-excel-file-and-download** – Srini 2014-11-11 12:16:59