开发者

How Can I generate a file in RemoteServiceServlet and send it to a user?

Maybe I can disable RemoteServic开发者_StackOverflow社区eServlet 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:

  1. Write another servlet which simply writes out the file content through the ServletResponse
  2. Make sure you have a binary header and provide the filename in there, too.
  3. In your client, make an <iframe ..> (The widget class for this is Frame) and point its url to your new servlet.

Due to the binary header your browser will now provide the user with a Save as.. popup. That should be all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜