[英]Invoke a Struts2 action and consume result as Stream
Is this possible, within the Struts2 framework, and/or am I limited to using the URL/URLConnection classes to get the response as a stream? 在Struts2框架内是否有可能,和/或我是否仅限于使用URL / URLConnection类以流形式获取响应? I've looked into the ActionComponent class but I'm not sure how to use it? 我已经研究了ActionComponent类,但不确定如何使用它?
Thanks. 谢谢。
I believe what you want is to use a StreamResult in your action. 我相信您想要的是在操作中使用StreamResult。 Check out the following: 查看以下内容:
http://struts.apache.org/2.1.2/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html http://struts.apache.org/2.1.2/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html
Here's an example for downloading a file: 这是下载文件的示例:
http://www.mkyong.com/struts2/struts-2-download-file-example/ http://www.mkyong.com/struts2/struts-2-download-file-example/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.