在 Struts2 框架内这可能吗?和/或我是否仅限于使用 URL/URLConnection 类来获取流形式的响应? 我已经研究过 ActionComponent 类,但我不确定如何使用它?
谢谢。
最佳答案
我相信您想要的是在您的操作中使用 StreamResult。查看以下内容:
http://struts.apache.org/2.1.2/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html
以下是下载文件的示例:
http://www.mkyong.com/struts2/struts-2-download-file-example/
关于java - 调用 Struts2 操作并将结果作为 Stream 使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5120502/