aspose file tools*
The moose likes Struts and the fly likes struts2 result type stream problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 result type stream problem" Watch "struts2 result type stream problem" New topic
Author

struts2 result type stream problem

Rajani Panchumarthy
Greenhorn

Joined: Jan 27, 2009
Posts: 22
HI,

I have the following configuration in struts.xml:
<result name="success" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">attachment; filename="${filename}"</param>
<param name="bufferSize">1024</param>
</result>

There is a method in the action class that returns bytearray input stream as follows:
public InputStream getInputStream () { return new ByteArrayInputStream (caseBytes ); }

But I get an exception saying that inputName parmater does not match the inputStream.
java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <param name="inputName"> tag specified for this action.


Could you please help.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

Can you show the complete action configuration and the URL you're using to access it?
Rajani Panchumarthy
Greenhorn

Joined: Jan 27, 2009
Posts: 22
1. Below is the action class code:

2. struts.xml contains the following configuration:
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That code doesn't reflect the code you showed in the first post.

Can you post the current code and the URL you're using to access the action?
Rajani Panchumarthy
Greenhorn

Joined: Jan 27, 2009
Posts: 22
Please find the current code:

1. Below is the action class code:


2. The method showCaseAttachmt() is written in ejb layer, where the business object,mgmtBO invokes the call.This method talks to the database, fetches the bytes of the file and returns a ByteArrayInputStream.



3. struts.xml contains the following configuration:


And the URL that is being used in JSP to invoke the action:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2 result type stream problem