You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lon Varscsak <lo...@gmail.com> on 2018/04/19 00:20:25 UTC

ResourceStreamRequestHandler and page refresh

Hey all,

I've got a Link that I use to generate and download a report.  I'm using a
ResourceStreamRequestHandler and
getRequestCycle().scheduleRequestHandlerAfterCurrent which works fine,
except that I was expecting my current request to finish as if it were a
regular link.  In this case, I'd want it to refresh the page I'm on, but it
doesn't do that.

Anyway to accomplish this?

-Lon

Re: ResourceStreamRequestHandler and page refresh

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can use wicket-examples as inspiration:
https://github.com/apache/wicket/blob/master/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AjaxDownloadPage.java

On Fri, Apr 20, 2018 at 1:20 AM, Lon Varscsak <lo...@gmail.com>
wrote:

> Okay, cool.  I did see this, but one of the things I was perplexed about is
> how to get an IResource into the AjaxDownloadBehavior at the time of
> onClick.  I guess in onClick I could set an ivar to some resource and model
> load from there.  Any other ideas?
>
> -Lon
>
> On Wed, Apr 18, 2018 at 9:53 PM, Sven Meier <sv...@meiers.net> wrote:
>
> > Hi,
> >
> > you'll have to update your page first and then initiate the download.
> >
> > For Ajax you can use:
> >  https://github.com/apache/wicket/blob/master/wicket-
> > extensions/src/main/java/org/apache/wicket/extensions/ajax/
> > AjaxDownloadBehavior.java
> >
> > For Wicket<8 you'll find its predecessor  AjaxDownload on the web.
> >
> > Have fun
> > Sven
> >
> > Am 19. April 2018 02:20:25 MESZ schrieb Lon Varscsak <
> > lon.varscsak@gmail.com>:
> > >Hey all,
> > >
> > >I've got a Link that I use to generate and download a report.  I'm
> > >using a
> > >ResourceStreamRequestHandler and
> > >getRequestCycle().scheduleRequestHandlerAfterCurrent which works fine,
> > >except that I was expecting my current request to finish as if it were
> > >a
> > >regular link.  In this case, I'd want it to refresh the page I'm on,
> > >but it
> > >doesn't do that.
> > >
> > >Anyway to accomplish this?
> > >
> > >-Lon
> >
>

Re: ResourceStreamRequestHandler and page refresh

Posted by Lon Varscsak <lo...@gmail.com>.
Okay, cool.  I did see this, but one of the things I was perplexed about is
how to get an IResource into the AjaxDownloadBehavior at the time of
onClick.  I guess in onClick I could set an ivar to some resource and model
load from there.  Any other ideas?

-Lon

On Wed, Apr 18, 2018 at 9:53 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> you'll have to update your page first and then initiate the download.
>
> For Ajax you can use:
>  https://github.com/apache/wicket/blob/master/wicket-
> extensions/src/main/java/org/apache/wicket/extensions/ajax/
> AjaxDownloadBehavior.java
>
> For Wicket<8 you'll find its predecessor  AjaxDownload on the web.
>
> Have fun
> Sven
>
> Am 19. April 2018 02:20:25 MESZ schrieb Lon Varscsak <
> lon.varscsak@gmail.com>:
> >Hey all,
> >
> >I've got a Link that I use to generate and download a report.  I'm
> >using a
> >ResourceStreamRequestHandler and
> >getRequestCycle().scheduleRequestHandlerAfterCurrent which works fine,
> >except that I was expecting my current request to finish as if it were
> >a
> >regular link.  In this case, I'd want it to refresh the page I'm on,
> >but it
> >doesn't do that.
> >
> >Anyway to accomplish this?
> >
> >-Lon
>

Re: ResourceStreamRequestHandler and page refresh

Posted by Sven Meier <sv...@meiers.net>.
Hi,

you'll have to update your page first and then initiate the download.

For Ajax you can use:
 https://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java

For Wicket<8 you'll find its predecessor  AjaxDownload on the web.

Have fun
Sven

Am 19. April 2018 02:20:25 MESZ schrieb Lon Varscsak <lo...@gmail.com>:
>Hey all,
>
>I've got a Link that I use to generate and download a report.  I'm
>using a
>ResourceStreamRequestHandler and
>getRequestCycle().scheduleRequestHandlerAfterCurrent which works fine,
>except that I was expecting my current request to finish as if it were
>a
>regular link.  In this case, I'd want it to refresh the page I'm on,
>but it
>doesn't do that.
>
>Anyway to accomplish this?
>
>-Lon