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? I've looked into the ActionComponent class but I'm not sure how to 开发者_Go百科use it?
Thanks.
I believe what you want is to use a StreamResult in your action. Check out the following:
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/
精彩评论