You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vineet Chopra <vi...@gmail.com> on 2007/06/21 21:59:46 UTC

FileDownload Action in struts2-showcase

Hello,
I was trying to modify in struts2-showcase - FileDownload action to read a
jpeg file located in the local machine, not in the webapp.
First of all is it possible to read and display local file?

when i changed i am getting this error :--
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.

	org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:189)
	org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)
	com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:343)
	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
	org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:507)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
	org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)


 Changes in struts.xml
<action name="download" class="
com.xxx.xxxxxx.webapp.action.FileDownloadAction">
               <param name="inputPath">C:/welcome2.gif</param>
            <result name="success" type="stream">
                <param name="contentType">image/gif</param>
                <param name="inputName">inputStream</param>
                <param name="contentDisposition">filename="welcome2.gif
"</param>
                <param name="bufferSize">4096</param>
            </result>
        </action>

Any help will be appreciated. Thanks a lot

-- 
Thank you,
Vineet