You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lu...@yahoo.co.jp on 2010/09/16 04:01:00 UTC

How to download a file without creating it on a server

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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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

Posted by Dave Newton <da...@gmail.com>.
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 need to be a file. Or just stream
directly to the response and return null.

Dave

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


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

Posted by lu...@yahoo.co.jp.
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


--- lunch716@yahoo.co.jp wrote:

> 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 by strtus2 to close
> all
> streams,even though it is possible
> SequenceInputStream.close(=nextStream)
> not to try to close all streams by throwing IOException.   
> 
> #### code #####
>     SequenceInputStream seq1 = null;
>     
>     ByteArrayInputStream bai1 = null;
>     ByteArrayInputStream bai2 = null;
>     ByteArrayInputStream bai3 = null;
>     
>     try {
>        String str1 = new String("aaa");
>        bai1 = new ByteArrayInputStream(str1.getBytes("UTF-8"));
>             
>        String str2 = new String("bbb");
>        bai2 = new ByteArrayInputStream(str2.getBytes("UTF-8"));
>        seq1 = new SequenceInputStream(bai1, bai2);
> 
>        String str3 = new String("ccc");
>        bai3 = new ByteArrayInputStream(str3.getBytes("UTF-8"));
>             
>        this.inputStream = new SequenceInputStream(seq1, bai3);
>         } catch (UnsupportedEncodingException e) {
>            
>             e.printStackTrace();
>         }finally{
>            //don't close streams(seq1, bai1, bai2, bai3) 
>         }
>    }
> ###############
> 
> Thanks.
> 
> Ken
> 
> --- Dale Newfield <da...@newfield.org> wrote:
> 
> > java.io.SequenceInputStream might prove helpful to you here, as
> well.
> > 
> > -Dale
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


--------------------------------------
What is the No.1 drama, music and car of 2010 ?
    - Yahoo! JAPAN  Net BANZUKE 2010 -
http://pr.mail.yahoo.co.jp/banzuke/

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


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

Posted by lu...@yahoo.co.jp.
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 by strtus2 to close all
streams,even though it is possible SequenceInputStream.close(=nextStream)
not to try to close all streams by throwing IOException.   

#### code #####
    SequenceInputStream seq1 = null;
    
    ByteArrayInputStream bai1 = null;
    ByteArrayInputStream bai2 = null;
    ByteArrayInputStream bai3 = null;
    
    try {
       String str1 = new String("aaa");
       bai1 = new ByteArrayInputStream(str1.getBytes("UTF-8"));
            
       String str2 = new String("bbb");
       bai2 = new ByteArrayInputStream(str2.getBytes("UTF-8"));
       seq1 = new SequenceInputStream(bai1, bai2);

       String str3 = new String("ccc");
       bai3 = new ByteArrayInputStream(str3.getBytes("UTF-8"));
            
       this.inputStream = new SequenceInputStream(seq1, bai3);
        } catch (UnsupportedEncodingException e) {
           
            e.printStackTrace();
        }finally{
           //don't close streams(seq1, bai1, bai2, bai3) 
        }
   }
###############

Thanks.

Ken

--- Dale Newfield <da...@newfield.org> wrote:

> java.io.SequenceInputStream might prove helpful to you here, as well.
> 
> -Dale
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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

Posted by Dale Newfield <da...@newfield.org>.
java.io.SequenceInputStream might prove helpful to you here, as well.

-Dale

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


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

Posted by lu...@yahoo.co.jp.
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$B>+%M(B Wielgus <po...@gmail.com> wrote:

> 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 manipulated (concatenated, changed, etc.)
> the temporary file is needed if You don't want to put all data into
> memory.
> Of course You can create Your own stream that will put only small
> chunks of data into memory,
> but that's not trivial to do.
> 
> Hope that helps,
> Pawe$B<G(B&#65533; Wielgus.
> 
> 
> 2010/9/16  <lu...@yahoo.co.jp>:
> > 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 exactly.
> >
> > Thanks anyway.
> >
> > --- Pawe$Bt,<>je(B&#65533; Wielgus <po...@gmail.com> wrote:
> >
> >> Hi all,
> >> try this for example:
> >>
> >> public InputStream getInputStream() throws ParseException,
> >> UnsupportedEncodingException {
> >> $B<D(B $B<D(B $B<D(B $B<D(B StringBuffer sb = new StringBuffer("blablabla")
> >> $B<D(B $B<D(B $B<D(B $B<D(B ....
> >> $B<D(B $B<D(B $B<D(B $B<D(B return new
> >> ByteArrayInputStream(sb.toString().getBytes("windows-1250"));
> >> }
> >>
> >> Best greetings,
> >> Pawe$Bjd<=jd<+|<(B&#65533; Wielgus.
> >>
> >>
> >> 2010/9/16 Tommy Pham <to...@gmail.com>:
> >> >
> >> >> -----Original Message-----
> >> >> From: lunch716@yahoo.co.jp [mailto:lunch716@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 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.
> >> >>
> >> >>
> >> >
> >> > IIRC, Struts uses the Apache Commons FileUpload
> >> > http://commons.apache.org/fileupload/.
> >> > You could read more about the Streaming API with examples in the
> >> provided
> >> > link.
> >> >
> >> > Regards,
> >> > Tommy
> >> >
> >> >
> >> >
> >>
> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail: user-help@struts.apache.org
> >> >
> >> >
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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

Posted by Paweł Wielgus <po...@gmail.com>.
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 manipulated (concatenated, changed, etc.)
the temporary file is needed if You don't want to put all data into memory.
Of course You can create Your own stream that will put only small
chunks of data into memory,
but that's not trivial to do.

Hope that helps,
Paweł Wielgus.


2010/9/16  <lu...@yahoo.co.jp>:
> 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 exactly.
>
> Thanks anyway.
>
> --- Pawe娼ネ Wielgus <po...@gmail.com> wrote:
>
>> 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セォ縞 Wielgus.
>>
>>
>> 2010/9/16 Tommy Pham <to...@gmail.com>:
>> >
>> >> -----Original Message-----
>> >> From: lunch716@yahoo.co.jp [mailto:lunch716@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 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.
>> >>
>> >>
>> >
>> > IIRC, Struts uses the Apache Commons FileUpload
>> > http://commons.apache.org/fileupload/.
>> > You could read more about the Streaming API with examples in the
>> provided
>> > link.
>> >
>> > Regards,
>> > Tommy
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


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

Posted by lu...@yahoo.co.jp.
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 exactly.

Thanks anyway.

--- Pawe娼ネ Wielgus <po...@gmail.com> wrote:

> 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セォ縞 Wielgus.
> 
> 
> 2010/9/16 Tommy Pham <to...@gmail.com>:
> >
> >> -----Original Message-----
> >> From: lunch716@yahoo.co.jp [mailto:lunch716@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 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.
> >>
> >>
> >
> > IIRC, Struts uses the Apache Commons FileUpload
> > http://commons.apache.org/fileupload/.
> > You could read more about the Streaming API with examples in the
> provided
> > link.
> >
> > Regards,
> > Tommy
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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

Posted by Paweł Wielgus <po...@gmail.com>.
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ł Wielgus.


2010/9/16 Tommy Pham <to...@gmail.com>:
>
>> -----Original Message-----
>> From: lunch716@yahoo.co.jp [mailto:lunch716@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 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.
>>
>>
>
> IIRC, Struts uses the Apache Commons FileUpload
> http://commons.apache.org/fileupload/.
> You could read more about the Streaming API with examples in the provided
> link.
>
> Regards,
> Tommy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


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

Posted by Tommy Pham <to...@gmail.com>.
> -----Original Message-----
> From: lunch716@yahoo.co.jp [mailto:lunch716@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 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.
> 
> 

IIRC, Struts uses the Apache Commons FileUpload
http://commons.apache.org/fileupload/.
You could read more about the Streaming API with examples in the provided
link.

Regards,
Tommy


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


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

Posted by lu...@yahoo.co.jp.
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 <Al...@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  <lu...@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-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


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

Posted by Allen Lee <Al...@asu.edu>.
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  <lu...@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org