Re: How to download a file without creating it on a server

2010-11-25 Thread lunch716
Hi, I found the following the thread, and now I apply that method. I think it is the best solution for this issue.(namely create custom Result class) http://www.mail-archive.com/user@struts.apache.org/msg79822.html Thanks. Ken --- lunch...@yahoo.co.jp wrote: Hi Dale, Thank you for your

Re: How to download a file without creating it on a server

2010-09-16 Thread Paweł Wielgus
Hi all, try this for example: public InputStream getInputStream() throws ParseException, UnsupportedEncodingException { StringBuffer sb = new StringBuffer(blablabla) return new ByteArrayInputStream(sb.toString().getBytes(windows-1250)); } Best greetings, Paweł

Re: How to download a file without creating it on a server

2010-09-16 Thread lunch716
Hi Wielgus, Thank you for the example. That example you provided can work fine. But I'm afraid I can not apply this way. When using ByteArrayInputStream, I need to hold all contents of a download file.But I must handle a huge file that can not be placed in memory. I'm sorry that I did not tell

Re: How to download a file without creating it on a server

2010-09-16 Thread Paweł Wielgus
Hi, it all depends. Where You take data from - database? How You manipulate the data if any - are You combining some fields or something? It's possible to take some data from DB and read it from reasult set as a stream and just forward it to the user browser. But if this data has to be

Re: How to download a file without creating it on a server

2010-09-16 Thread lunch716
Hi Pawel, But if this data has to be manipulated (concatenated, changed, etc.) the temporary file is needed if You don't want to put all data into memory. FYI in my case, I need to manipulate with data from DB and files to create a download file. Thanks. --- Pawe娼ネ Wielgus

Re: How to download a file without creating it on a server

2010-09-16 Thread Dale Newfield
java.io.SequenceInputStream might prove helpful to you here, as well. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org

Re: How to download a file without creating it on a server

2010-09-16 Thread lunch716
Hi Dale, Thank you for your reply. It sounds I can make it, even though there might be some problems about closing streams. When I coded like the following, I could get the download file(i.e. I could concatenate the ByteArrayInputStream objects. ) Note.I must rely on SequenceInputStream refered

How to download a file without creating it on a server

2010-09-15 Thread lunch716
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

Re: How to download a file without creating it on a server

2010-09-15 Thread Dave Newton
On Wednesday, September 15, 2010, wrote: 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? A stream is a stream-doesn't

Re: How to download a file without creating it on a server

2010-09-15 Thread Allen Lee
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

Re: How to download a file without creating it on a server

2010-09-15 Thread lunch716
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

RE: How to download a file without creating it on a server

2010-09-15 Thread Tommy Pham
-Original Message- From: lunch...@yahoo.co.jp [mailto:lunch...@yahoo.co.jp] Sent: Wednesday, September 15, 2010 9:23 PM To: Struts Users Mailing List Subject: Re: How to download a file without creating it on a server Hi Dave and Allen, Thank you for quick reply. Frankly