Re: How to trace that a resource was requested?

2019-03-17 Thread Per Newgro

Thanks Martin, good guess.

Regards
Per


Hi,

You can use Link#onClick() to count and then throw
RedirectToUrlException(urlFor(yourResourceReference)) that will lead to a
redirect.

On Tue, Mar 12, 2019 at 3:11 PM Per Newgro  wrote:


Hello,

i like to log that a resource (PDF file), generated in backend, was
requested.

The resource is mounted by a resource reference. An external link is using
url to resource reference.
Download of file generated by resource is working.

But I like to avoid log of every request to resource. If the resource is
requested without clicking the link
i don't want to log the request. So i can not log the request while
resource is generated. I need an onClick.

I guess i can not use ExternalLink because it is not calling the server
after click.
Maybe i need to use ResourceLink, but with that component no one is
calling it's onClick method.

Is there any example on how to listen to downloads?

Thanks for your support
Per

-
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: How to trace that a resource was requested?

2019-03-12 Thread Martin Grigorov
Hi,

You can use Link#onClick() to count and then throw
RedirectToUrlException(urlFor(yourResourceReference)) that will lead to a
redirect.

On Tue, Mar 12, 2019 at 3:11 PM Per Newgro  wrote:

> Hello,
>
> i like to log that a resource (PDF file), generated in backend, was
> requested.
>
> The resource is mounted by a resource reference. An external link is using
> url to resource reference.
> Download of file generated by resource is working.
>
> But I like to avoid log of every request to resource. If the resource is
> requested without clicking the link
> i don't want to log the request. So i can not log the request while
> resource is generated. I need an onClick.
>
> I guess i can not use ExternalLink because it is not calling the server
> after click.
> Maybe i need to use ResourceLink, but with that component no one is
> calling it's onClick method.
>
> Is there any example on how to listen to downloads?
>
> Thanks for your support
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to trace that a resource was requested?

2019-03-12 Thread Ernesto Reinaldo Barreiro
Hi,

Why not simply append a parameter to URL that tells download comes from
your link? And use that to discriminate when to log or not...

On Tue, Mar 12, 2019 at 4:11 PM Per Newgro  wrote:

> Hello,
>
> i like to log that a resource (PDF file), generated in backend, was
> requested.
>
> The resource is mounted by a resource reference. An external link is using
> url to resource reference.
> Download of file generated by resource is working.
>
> But I like to avoid log of every request to resource. If the resource is
> requested without clicking the link
> i don't want to log the request. So i can not log the request while
> resource is generated. I need an onClick.
>
> I guess i can not use ExternalLink because it is not calling the server
> after click.
> Maybe i need to use ResourceLink, but with that component no one is
> calling it's onClick method.
>
> Is there any example on how to listen to downloads?
>
> Thanks for your support
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-- 
Regards - Ernesto Reinaldo Barreiro