Hi Dave and Allen, Thank you for quick reply.
Frankly speaking, I'm not familiarity with using stream and could not come up with some ideas. When I coded with java.io.PipedInputStream/PipedOutputStream like follwoing, I could download an empty file with IllegalStateException. If anyone give an example how to code,I will really appreciate. Thanks. ### sample code ### public class FileDownload extends ActionSupport{ public InputStream inputStream; public String download() throws Exception { PipedOutputStream pipeOut = new PipedOutputStream(); PipedInputStream pipeIn = null; try { pipeIn = new PipedInputStream(pipeOut); this.inputStream = pipeIn; String str = new String("111"); byte[] data = str.getBytes("UTF-8"); pipeOut.write(data); //the following code does not response to client. // pipeOut.write(111); // pipeOut.write(data,0,data.length ); } catch (IOException e) { e.printStackTrace(); } finally { //close stream } return "success"; } } ####### #### IllegalStateException ### java.lang.IllegalStateException at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:405) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:770) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) ############### --- Allen Lee <allen....@asu.edu> wrote: > Sometimes I'll create a temp file via File.createTempFile and open an > InputStream for that but you could just as easily use one of these > techniques: > > http://ostermiller.org/convert_java_outputstream_inputstream.html > > 2010/9/15 <lunch...@yahoo.co.jp>: > > I would like to collect the data by accessing database and create > the > > contents for a download file. > > > > Without creating the real file for InputStream that the struts2 > convention > > proposes to use for download, how to code? > > > > Regards. > > > > -------------------------------------- > > Get the new Internet Explorer 8 optimized for Yahoo! JAPAN > > http://pr.mail.yahoo.co.jp/ie8/ > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > > > -- > Allen Lee > Center for the Study of Institutional Diversity [http://csid.asu.edu] > Arizona State University | P.O. Box 872402 | Tempe, Arizona > 85287-2402 > Office: 480.727.0401 | Fax: 480.965.7671 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -------------------------------------- Get the new Internet Explorer 8 optimized for Yahoo! JAPAN http://pr.mail.yahoo.co.jp/ie8/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org