I think he makes a valid point, personally. People do want to do this sort
of thing quite frequently. It wouldn't kill us to implement an
OutputStreamLink that looked like this:

add(new StreamingLink("link") {
    public String getFileName() {
        return "download.xls";
    }
    public String getMimeType() {
        return "application/vnd.excel"; // Or whatever it is.
    }
    public void writeToOutputStream(OutputStream outputStream) {
        excelGenerator.writeOutput(outputStream);
    }
});

I don't think the current API here is very pleasant or obvious to use.

Regards,

Al

On Tue, Apr 1, 2008 at 1:15 PM, Peter Ertl <[EMAIL PROTECTED]> wrote:

> use AbstractResourceStreamWriter
>
>  > Wicket got to have a more structured api for this common task.
> usually it's not wicket but you when something is not working the way
> you expect it
>
>
>
>
>
> Am 01.04.2008 um 09:31 schrieb [EMAIL PROTECTED]:
>
> > 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to