Hello,

I did some digging on this but couldn't find anything. I have an action which is returning a streamed result. I create a zip file in memory and stream it out to the user. This works fine when the user simply clicks the link. I get the correct file, with the right name. However, as of right now, if the user right clicks on the link and goes to "Save Link As", the link comes up to save as the action name instead of the zip file, and it gives the following error:

Exception 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.

However, if I click the link it works fine.

The code in my action looks like:

        public InputStream getInputStream() throws Exception{
                
                String contentType="application/octet-stream";
                
                Result result = 
ActionContext.getContext().getActionInvocation().getResult();
                if(result != null && result instanceof StreamResult){
                        StreamResult streamResult = (StreamResult)result;
                        streamResult.setContentType(contentType);
                        streamResult.setContentDisposition("attachment; filename=\"" + 
plateName + ".zip\"");
                }
                
                return new ByteArrayInputStream(bos.toByteArray());
                
        }

Any suggestions? Ideally I'd like the user to be able to right click and save 
the link and get the correct zip file. I feel as though I've seen this done on 
other sites, but can't find an example.

Thanks,
Tim


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to