Re: Input Stream DownloadLink

2016-01-06 Thread Martin Spielmann
Thanks a lot for the feedback,

i'll try to improve things according to these hints. Maybe i'm able to do some 
performance measurements also. If the outcome is something useful i'll share 
the results again.

Best regards,
Martin



On Wednesday, January 06, 2016 08:45:25 AM Martin Grigorov wrote:
> Hi,
> 
> Thanks for sharing your component with us!
> 
> In the "about" section you use LoadableDetachableModel that returns
> InputStream. For single use this would work fine, but if you try to use
> this model second time in the same request then it may fail depending on
> the type of the InputStream because you may need to reset it. I cannot
> imagine now a use case where you will need to use it second time in the
> same request but I also see no reason to use LDM. Using
> AbstractReadOnlyModel looks better to me.
> 
> Apart from that I think you can use "new ResourceLink(String, IResource)"
> for the same kind of tasks. E.g. with ByteArrayResource that either accepts
> its byte[] as constructor parameter or loads it dynamically by overriding
> #getData().
> 
> Happy New Year!
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Wed, Jan 6, 2016 at 12:16 AM, Martin Spielmann <
> 
> martin.spielm...@pingunaut.com> wrote:
> > Hello all,
> > 
> > I just published a small version of a download link which enables you to
> > serve
> > any data coming from an InputStream for download.
> > 
> > https://github.com/pingunaut/wicket-stream-download-example
> > 
> > I used that one in multiple projects now, so I thought it could be
> > interesting
> > for other people too.
> > Just wanted to hear, if there any need for this one out there before
> > spending
> > more effort for docs and error handling.
> > 
> > Happy new year!
> > 
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org

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



Re: Input Stream DownloadLink

2016-01-05 Thread Štefan Šimík
Hi Martin,
I found it very useful and really appreciate you contribution.
I think it is definitely worth of effort, if something very similar does
not already exist in wicket distribution.
In that case, it would be great source of inspiration for new pull-request
into wicket.

Simple, short and clean description. I like that :)
Good work Martin

On Wed, Jan 6, 2016 at 12:16 AM, Martin Spielmann <
martin.spielm...@pingunaut.com> wrote:

> Hello all,
>
> I just published a small version of a download link which enables you to
> serve
> any data coming from an InputStream for download.
>
> https://github.com/pingunaut/wicket-stream-download-example
>
> I used that one in multiple projects now, so I thought it could be
> interesting
> for other people too.
> Just wanted to hear, if there any need for this one out there before
> spending
> more effort for docs and error handling.
>
> Happy new year!
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Input Stream DownloadLink

2016-01-05 Thread Martin Grigorov
Hi,

Thanks for sharing your component with us!

In the "about" section you use LoadableDetachableModel that returns
InputStream. For single use this would work fine, but if you try to use
this model second time in the same request then it may fail depending on
the type of the InputStream because you may need to reset it. I cannot
imagine now a use case where you will need to use it second time in the
same request but I also see no reason to use LDM. Using
AbstractReadOnlyModel looks better to me.

Apart from that I think you can use "new ResourceLink(String, IResource)"
for the same kind of tasks. E.g. with ByteArrayResource that either accepts
its byte[] as constructor parameter or loads it dynamically by overriding
#getData().

Happy New Year!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Jan 6, 2016 at 12:16 AM, Martin Spielmann <
martin.spielm...@pingunaut.com> wrote:

> Hello all,
>
> I just published a small version of a download link which enables you to
> serve
> any data coming from an InputStream for download.
>
> https://github.com/pingunaut/wicket-stream-download-example
>
> I used that one in multiple projects now, so I thought it could be
> interesting
> for other people too.
> Just wanted to hear, if there any need for this one out there before
> spending
> more effort for docs and error handling.
>
> Happy new year!
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Input Stream DownloadLink

2016-01-05 Thread Martin Spielmann
Hello all,

I just published a small version of a download link which enables you to serve 
any data coming from an InputStream for download.

https://github.com/pingunaut/wicket-stream-download-example

I used that one in multiple projects now, so I thought it could be interesting 
for other people too. 
Just wanted to hear, if there any need for this one out there before spending 
more effort for docs and error handling.

Happy new year!


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