You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Makoto Kameda <ma...@hotmail.com> on 2011/09/12 18:20:34 UTC
ByteArrayResource.getResourceStream() in Wicket 1.5
Hi there,
I have a problem while migrating from 1.4 to 1.5.
In 1.4 I have been using ByteArrayResource.getResourceStream() to
download dynamically generated PDF and ZIP with a file name.
Now it's removed in 1.5.
So how can I change this code:
1.4:
ByteArrayResource bar = new ByteArrayResource("application/pdf",
byteout.toByteArray());
IResourceStream stream = bar.getResourceStream();
RequestCycle.get().setRequestTarget(new
ResourceStreamRequestTarget(stream, fileName));
1.5;
ByteArrayResource bar = new ByteArrayResource("application/pdf",
byteout.toByteArray());
// ?? how can I convert it to a ResourceStream ??
IResourceStream stream = bar.getResourceStream();
RequestCycle.get().scheduleRequestHandlerAfterCurrent(new
ResourceStreamRequestHandler(stream, fileName));
makoto
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ByteArrayResource.getResourceStream() in Wicket 1.5
Posted by Martin Grigorov <mg...@apache.org>.
RequestCycle.get().scheduleRequestHandlerAfterCurrent(new
ResourceRequestHandler(bar, null));
On Mon, Sep 12, 2011 at 7:20 PM, Makoto Kameda
<ma...@hotmail.com> wrote:
> Hi there,
> I have a problem while migrating from 1.4 to 1.5.
> In 1.4 I have been using ByteArrayResource.getResourceStream() to download
> dynamically generated PDF and ZIP with a file name.
> Now it's removed in 1.5.
> So how can I change this code:
>
> 1.4:
> ByteArrayResource bar = new ByteArrayResource("application/pdf",
> byteout.toByteArray());
> IResourceStream stream = bar.getResourceStream();
>
> RequestCycle.get().setRequestTarget(new ResourceStreamRequestTarget(stream,
> fileName));
>
>
> 1.5;
> ByteArrayResource bar = new ByteArrayResource("application/pdf",
> byteout.toByteArray());
>
> // ?? how can I convert it to a ResourceStream ??
> IResourceStream stream = bar.getResourceStream();
>
> RequestCycle.get().scheduleRequestHandlerAfterCurrent(new
> ResourceStreamRequestHandler(stream, fileName));
>
>
> makoto
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org