wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Vaynberg" <igor.vaynb...@gmail.com>
Subject Re: export excel file via an OutputStream
Date Tue, 01 Apr 2008 08:09:39 GMT
is it really that difficult to do some legwork?

the hint in downloadlink is to do
getrequestcycle().setrequesttarget(new irequesttarget() {..});

irequesttarget has a respond(requestcycle cycle);

cycle in turn has a cycle.getresponse().getoutputstream().

-igor


On Tue, Apr 1, 2008 at 12:59 AM,  <dvd@newfoundmarket.com> wrote:
> This one (even with model args) falls to the same category of
>  getting the inputstream actively. I do not see how I can
>  define the model to get data since the controlling side is
>  excelGen(outputstream). it keeps writing data to outputstream.
>  and I am trying to get it directly send back to browser.
>  It has to directly write to the response stream in a single thread
>  or it would block.
>
>
>
>  >see DownloadLink
>  >
>  >-igor
>  >
>  >
>  >On Tue, Apr 1, 2008 at 12:45 AM,  <dvd@newfoundmarket.com> wrote:
>  >> This does not apply as it copies input to output.
>  >>  My issue is that in OnClick()  I  call
>  >>
>  >>  excelGen(OutputStream)
>  >>
>  >>  to produce the bytes on the fly.  but the ResourceStream
>  >>  needs InputStream that wicket would read data to send as response.
>  >>  My take is that I need to get a handle of the reponse
>  >>  outputstream to pass it to excelGen. But How to do it at wicket api level
>  >instead
>  >>  of bypass it to directly get servlet reponse stream.
>  >>
>  >>
>  >>
>  >>  >see Streams.copy() in wicket utils package
>  >>  >
>  >>  >-igor
>  >>  >
>  >>  >On Tue, Apr 1, 2008 at 12:31 AM,  <dvd@newfoundmarket.com> wrote:
>  >>  >> Hello:
>  >>  >>  I am trying to export dynamically generated excel file.
>  >>  >>  The generator would send the file.xls to an OutputStream.
>  >>  >>
>  >>  >>  In wicket, I am trying to use example as below but
>  >>  >>   how can I connect the OutputStream to the inputstream
>  >>  >>  ins.  Pipedoutputstream would block. Using a separate thread
>  >>  >>  is not desirable.
>  >>  >>
>  >>  >>  public void onClick() {
>  >>  >>
>  >>  >>    IResourceStream stream = new AbstractResourceStream() {
>  >>  >>
>  >>  >>                          public InputStream getInputStream() throws
>  >>  >ResourceStreamNotFoundException {
>  >>  >>
>  >>  >>
>  >>  >>                              return ins;
>  >>  >>                          }
>  >>  >>
>  >>  >>                          public void close() throws IOException {
>  >>  >>                              ins.close();
>  >>  >>                          }
>  >>  >>                      };
>  >>  >>
>  >>  >>                      getRequestCycle().setRequestTarget(
>  >>  >>                              new
>  >>  >ResourceStreamRequestTarget(stream).setFileName("file.xls"));
>  >>  >
>  >>  >---------------------------------------------------------------------
>  >>  >To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >>  >For additional commands, e-mail: users-help@wicket.apache.org
>  >>  >
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >>  For additional commands, e-mail: users-help@wicket.apache.org
>  >>
>  >>
>  >
>  >---------------------------------------------------------------------
>  >To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >For additional commands, e-mail: users-help@wicket.apache.org
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message