简体   繁体   English

Jersey ReST Web服务返回文件

[英]Jersey ReST webservice returning a File

I've found several good examples of how to return a File / OutputStream from a ReSTful Jersey webservice, but it appears that they all ultimately create a File on the file system. 我已经找到了几个有关如何从ReSTful Jersey Web服务返回File / OutputStream的好例子,但是看来它们最终都在文件系统上创建了File。 My problem is that I don't want to leave these files lingering around on the machine. 我的问题是我不想让这些文件在机器上徘徊。 Is there a way for me to clean-up once the service sends the response to the client without having to have some backend process monitoring the file system for these Files? 一旦服务将响应发送到客户端,我是否有办法清理而不必让某些后端进程监视这些文件的文件系统?

您只需要在base64中返回文件,然后进行处理即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM