Sumit
Sumit

Reputation: 1669

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 use it?

Thanks.

Upvotes: 1

Views: 867

Answers (1)

kvista
kvista

Reputation: 5059

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/

Upvotes: 1

Related Questions