本文介绍了如何在RemoteServiceServlet中生成文件并将其发送给用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
也许我可以禁用RemoteServiceServlet响应序列化或使用返回ServletOutputStram的方法定义RemoteService接口?我希望不要在任何数据库中保存请求,以便在另一个请求中处理它。 解决方案编写另一个servlet,通过ServletResponse写出文件内容 确保你有一个二进制头文件,并在那里提供文件名。 在你的客户端中,制作一个< iframe ..> (这个widget类是 Frame ),并将它的url指向新的servlet。 Write another servlet which simply writes out the file content through the ServletResponse
Make sure you have a binary header and provide the filename in there, too.
In your client, make an <iframe ..> (The widget class for this is Frame) and point its url to your new servlet.
如果您想提供下载到用户,你可以这样做:
由于二进制标题,您的浏览器现在将向用户提供另存为弹出窗口。这应该是全部。
Maybe I can disable RemoteServiceServlet response serialization or define RemoteService interface with method that returns ServletOutputStram? I would like not to save request in any database to file to process it in another request.
解决方案If you want to provide a download to the user, you can do it like this:
Due to the binary header your browser will now provide the user with a Save as.. popup. That should be all.
更多推荐
如何在RemoteServiceServlet中生成文件并将其发送给用户?
发布评论