JAX-WS MTOM 发送到客户端后删除附件
我正在使用 Java 1.6 的 JAX-WS 参考实现。在我的服务器上,我有 Web 服务方法,它返回带有附件的响应作为 javax.activation.DataHandler。
File myFile = new File("tempFile.txt"); //existing temp file to send back
DataHandler dh = new DataHandler(new FileDataSource(myFile));
//cant delete myFile yet, but end of web service method
我需要做的是将文件从服务器完全发送到客户端后删除。然而,我的网络服务方法在客户端发送响应之前就已经完成了。
我可以做什么来将文件标记为删除,或者是否有一个回调可以挂钩以在传输后删除文件?
谢谢
I am using the reference implementation of JAX-WS with Java 1.6. On my server I have Web Service method which returns a response with an attachment as a javax.activation.DataHandler.
File myFile = new File("tempFile.txt"); //existing temp file to send back
DataHandler dh = new DataHandler(new FileDataSource(myFile));
//cant delete myFile yet, but end of web service method
What I need to do is delete the file after it has been completely sent from the server to the client. However my webservice method has finished before the response is sent from the client.
What can I do to mark the file for deletion, or is there a callback I can hook into to delete the file after transmission?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题有一些答案
There are some answers to this question here.