【发布时间】:2012-04-23 11:06:21
【问题描述】:
我的要求是,我应该向客户端发送一个 10MB 的 zip 文件,并提供 RESTful 服务。我在论坛中发现发送StreamingOutput 对象是更好的方法的代码,但是如何在以下代码中创建StreamingOutput 对象:
@Path("PDF-file.pdf/")
@GET
@Produces({"application/pdf"})
public StreamingOutput getPDF() throws Exception {
return new StreamingOutput() {
public void write(OutputStream output) throws IOException, WebApplicationException
{
try {
//------
} catch (Exception e) {
throw new WebApplicationException(e);
}
}
};
}
【问题讨论】: