You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Asenov <mA...@velti.com> on 2010/03/01 13:31:48 UTC

How can i know when a users redirects to other page

Hello, everyone!

I was wondering if there's a way to know for instance if the user is on a page is there an event fired that indicates that the user is no longer on this page. I saw the method 'onRedirect()', but it's fired when the user comes to the page. I want to know when the user changes the page.

Thanks in advance!

Regards,
Martin


Re: How can i know when a users redirects to other page

Posted by Riyad Kalla <rk...@gmail.com>.
1 other idea (among others that would probably work) is a custom
IRequestCycleProcessor impl that checks the returned IRequestTarget (
http://wicket.apache.org/docs/1.4/org/apache/wicket/IRequestTarget.html) to
see if it's sending back the PageRequestTarget (
http://wicket.apache.org/docs/1.4/org/apache/wicket/request/target/component/PageRequestTarget.html)
that belongs to the page that generates the temp file, and if it is,
generate the file, if it isn't, erase it.

I'll admit I've not done any of this, so I'd defer to someone smarter for
the "right" approach. These are just ideas.

On Mon, Mar 1, 2010 at 9:44 AM, Martin Asenov <mA...@velti.com> wrote:

> Thank you all for the support, I highly appreciate it!
>
> Regards,
> Martin
>
> -----Original Message-----
> From: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com]
> Sent: Monday, March 01, 2010 5:31 PM
> To: users@wicket.apache.org
> Subject: Re: How can i know when a users redirects to other page
>
> Just an idea... Use a component instantiation listener and "delete" the
> file, if it exists, whenever any other page is created.
>
> Regards,
>
> Ernesto
>
> On Mon, Mar 1, 2010 at 4:09 PM, Martin Asenov <mA...@velti.com> wrote:
>
> > The use case is that I generate a file located in a temp folder that
> > appears on page under a download link. I want to delete the file when the
> > user goes in another page.
> >
> > Regards,
> > Martin
> >
> > -----Original Message-----
> > From: Riyad Kalla [mailto:rkalla@gmail.com]
> > Sent: Monday, March 01, 2010 4:31 PM
> > To: users@wicket.apache.org
> > Subject: Re: How can i know when a users redirects to other page
> >
> > Martin can you explain your use-case, namely what is the importance of
> > seeing which page a user is no-longer on?
> >
> > Seems like a super-easy way to do this would be to extend a base-page
> that
> > updates a Session metadata element with the current page the user is on
> and
> > allow a listener to be notified when this changes?
> >
> > But depending on who you want listening to this I suppose you could do
> away
> > with the whole listener/metadata thing and just have your basepage call
> > some
> > trigger method onRender that would do some work?
> >
> > -R
> >
> > On Mon, Mar 1, 2010 at 5:31 AM, Martin Asenov <mA...@velti.com> wrote:
> >
> > > Hello, everyone!
> > >
> > > I was wondering if there's a way to know for instance if the user is on
> a
> > > page is there an event fired that indicates that the user is no longer
> on
> > > this page. I saw the method 'onRedirect()', but it's fired when the
> user
> > > comes to the page. I want to know when the user changes the page.
> > >
> > > Thanks in advance!
> > >
> > > Regards,
> > > Martin
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: How can i know when a users redirects to other page

Posted by Martin Asenov <mA...@velti.com>.
Thank you all for the support, I highly appreciate it!

Regards,
Martin

-----Original Message-----
From: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com] 
Sent: Monday, March 01, 2010 5:31 PM
To: users@wicket.apache.org
Subject: Re: How can i know when a users redirects to other page

Just an idea... Use a component instantiation listener and "delete" the
file, if it exists, whenever any other page is created.

Regards,

Ernesto

On Mon, Mar 1, 2010 at 4:09 PM, Martin Asenov <mA...@velti.com> wrote:

> The use case is that I generate a file located in a temp folder that
> appears on page under a download link. I want to delete the file when the
> user goes in another page.
>
> Regards,
> Martin
>
> -----Original Message-----
> From: Riyad Kalla [mailto:rkalla@gmail.com]
> Sent: Monday, March 01, 2010 4:31 PM
> To: users@wicket.apache.org
> Subject: Re: How can i know when a users redirects to other page
>
> Martin can you explain your use-case, namely what is the importance of
> seeing which page a user is no-longer on?
>
> Seems like a super-easy way to do this would be to extend a base-page that
> updates a Session metadata element with the current page the user is on and
> allow a listener to be notified when this changes?
>
> But depending on who you want listening to this I suppose you could do away
> with the whole listener/metadata thing and just have your basepage call
> some
> trigger method onRender that would do some work?
>
> -R
>
> On Mon, Mar 1, 2010 at 5:31 AM, Martin Asenov <mA...@velti.com> wrote:
>
> > Hello, everyone!
> >
> > I was wondering if there's a way to know for instance if the user is on a
> > page is there an event fired that indicates that the user is no longer on
> > this page. I saw the method 'onRedirect()', but it's fired when the user
> > comes to the page. I want to know when the user changes the page.
> >
> > Thanks in advance!
> >
> > Regards,
> > Martin
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: How can i know when a users redirects to other page

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Just an idea... Use a component instantiation listener and "delete" the
file, if it exists, whenever any other page is created.

Regards,

Ernesto

On Mon, Mar 1, 2010 at 4:09 PM, Martin Asenov <mA...@velti.com> wrote:

> The use case is that I generate a file located in a temp folder that
> appears on page under a download link. I want to delete the file when the
> user goes in another page.
>
> Regards,
> Martin
>
> -----Original Message-----
> From: Riyad Kalla [mailto:rkalla@gmail.com]
> Sent: Monday, March 01, 2010 4:31 PM
> To: users@wicket.apache.org
> Subject: Re: How can i know when a users redirects to other page
>
> Martin can you explain your use-case, namely what is the importance of
> seeing which page a user is no-longer on?
>
> Seems like a super-easy way to do this would be to extend a base-page that
> updates a Session metadata element with the current page the user is on and
> allow a listener to be notified when this changes?
>
> But depending on who you want listening to this I suppose you could do away
> with the whole listener/metadata thing and just have your basepage call
> some
> trigger method onRender that would do some work?
>
> -R
>
> On Mon, Mar 1, 2010 at 5:31 AM, Martin Asenov <mA...@velti.com> wrote:
>
> > Hello, everyone!
> >
> > I was wondering if there's a way to know for instance if the user is on a
> > page is there an event fired that indicates that the user is no longer on
> > this page. I saw the method 'onRedirect()', but it's fired when the user
> > comes to the page. I want to know when the user changes the page.
> >
> > Thanks in advance!
> >
> > Regards,
> > Martin
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: RE: How can i know when a users redirects to other page

Posted by Martin Asenov <mA...@velti.com>.
Hi, Ernesto!

This is most likely the way I'll do the thing. I have a quartz scheduler and will arrange a recurring job that will clean files older than a day for instance.

Thank you all!
Best regards,
Martin

-----Original Message-----
From: Ernesto Reinaldo Barreiro [mailto:reiern70@gmail.com] 
Sent: Tuesday, March 02, 2010 12:35 PM
To: users@wicket.apache.org
Subject: Re: RE: How can i know when a users redirects to other page

just answered what he was asking;-). Another thing is if this is the best
solution for the use case. Maybe another possibility is to have a
background job that does clean unused files from time to time.

Best,

Ernesto

On Tue, Mar 2, 2010 at 11:28 AM, Sergey Olefir <so...@gmail.com> wrote:

>
>
> I'm not sure if session invalidation will be carried out if server
> stops/crashes. Although I think the session invalidation mechanism is still
> the most reliable of all that was proposed (my personal first reaction was
> "you can't do it reliably" -- although after reading the thread I have to
> agree that e.g. session invalidation might work).
>
> Anyway, if going session invalidation route, it might be necessary to clean
> up the directory at the server startup to make sure all stray files are
> cleaned up.
>
>
> reiern70 wrote:
> >
> >
> http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html
> >
> > Ernesto
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-can-i-know-when-a-users-redirects-to-other-page-tp27742803p27754252.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: RE: How can i know when a users redirects to other page

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
just answered what he was asking;-). Another thing is if this is the best
solution for the use case. Maybe another possibility is to have a
background job that does clean unused files from time to time.

Best,

Ernesto

On Tue, Mar 2, 2010 at 11:28 AM, Sergey Olefir <so...@gmail.com> wrote:

>
>
> I'm not sure if session invalidation will be carried out if server
> stops/crashes. Although I think the session invalidation mechanism is still
> the most reliable of all that was proposed (my personal first reaction was
> "you can't do it reliably" -- although after reading the thread I have to
> agree that e.g. session invalidation might work).
>
> Anyway, if going session invalidation route, it might be necessary to clean
> up the directory at the server startup to make sure all stray files are
> cleaned up.
>
>
> reiern70 wrote:
> >
> >
> http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html
> >
> > Ernesto
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-can-i-know-when-a-users-redirects-to-other-page-tp27742803p27754252.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: RE: How can i know when a users redirects to other page

Posted by Sergey Olefir <so...@gmail.com>.

I'm not sure if session invalidation will be carried out if server
stops/crashes. Although I think the session invalidation mechanism is still
the most reliable of all that was proposed (my personal first reaction was
"you can't do it reliably" -- although after reading the thread I have to
agree that e.g. session invalidation might work).

Anyway, if going session invalidation route, it might be necessary to clean
up the directory at the server startup to make sure all stray files are
cleaned up.


reiern70 wrote:
> 
> http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html
> 
> Ernesto
> 

-- 
View this message in context: http://old.nabble.com/How-can-i-know-when-a-users-redirects-to-other-page-tp27742803p27754252.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: RE: How can i know when a users redirects to other page

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpSessionListener.html

Ernesto

On Tue, Mar 2, 2010 at 8:52 AM, Martin Asenov <mA...@velti.com> wrote:

> Hi, Ed!
>
> How do I know when the session expires? I can't see a method onInvalidate()
> for instance. Would you give me a hint on this?
>
> Thank you all for the help!
>
> Best regards,
> Martin
>
> -----Original Message-----
> From: Edward Zarecor [mailto:edward@indeterminate.org]
> Sent: Tuesday, March 02, 2010 1:46 AM
> To: users@wicket.apache.org
> Subject: Re: RE: How can i know when a users redirects to other page
>
> Would on session expiry be a better place to handle this?  Implementation
> would be simple and you could avoid ever needing to regenerate a file if
> that is useful to you.  It also naturally handles the case where a user
> doesn't leave the page.
>
> Ed.
>
> On Mar 1, 2010 10:09 AM, "Martin Asenov" <mA...@velti.com> wrote:
>
> The use case is that I generate a file located in a temp folder that
> appears
> on page under a download link. I want to delete the file when the user goes
> in another page.
>
> Regards,
> Martin
>
>
> -----Original Message-----
> From: Riyad Kalla [mailto:rkalla@gmail.com]
> Sent: Monday, March 01, 201...
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

RE: RE: How can i know when a users redirects to other page

Posted by Martin Asenov <mA...@velti.com>.
Hi, Ed!

How do I know when the session expires? I can't see a method onInvalidate() for instance. Would you give me a hint on this?

Thank you all for the help!

Best regards,
Martin

-----Original Message-----
From: Edward Zarecor [mailto:edward@indeterminate.org] 
Sent: Tuesday, March 02, 2010 1:46 AM
To: users@wicket.apache.org
Subject: Re: RE: How can i know when a users redirects to other page

Would on session expiry be a better place to handle this?  Implementation
would be simple and you could avoid ever needing to regenerate a file if
that is useful to you.  It also naturally handles the case where a user
doesn't leave the page.

Ed.

On Mar 1, 2010 10:09 AM, "Martin Asenov" <mA...@velti.com> wrote:

The use case is that I generate a file located in a temp folder that appears
on page under a download link. I want to delete the file when the user goes
in another page.

Regards,
Martin


-----Original Message-----
From: Riyad Kalla [mailto:rkalla@gmail.com]
Sent: Monday, March 01, 201...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

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


Re: RE: How can i know when a users redirects to other page

Posted by Edward Zarecor <ed...@indeterminate.org>.
Would on session expiry be a better place to handle this?  Implementation
would be simple and you could avoid ever needing to regenerate a file if
that is useful to you.  It also naturally handles the case where a user
doesn't leave the page.

Ed.

On Mar 1, 2010 10:09 AM, "Martin Asenov" <mA...@velti.com> wrote:

The use case is that I generate a file located in a temp folder that appears
on page under a download link. I want to delete the file when the user goes
in another page.

Regards,
Martin


-----Original Message-----
From: Riyad Kalla [mailto:rkalla@gmail.com]
Sent: Monday, March 01, 201...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

RE: How can i know when a users redirects to other page

Posted by Martin Asenov <mA...@velti.com>.
The use case is that I generate a file located in a temp folder that appears on page under a download link. I want to delete the file when the user goes in another page.

Regards,
Martin

-----Original Message-----
From: Riyad Kalla [mailto:rkalla@gmail.com] 
Sent: Monday, March 01, 2010 4:31 PM
To: users@wicket.apache.org
Subject: Re: How can i know when a users redirects to other page

Martin can you explain your use-case, namely what is the importance of
seeing which page a user is no-longer on?

Seems like a super-easy way to do this would be to extend a base-page that
updates a Session metadata element with the current page the user is on and
allow a listener to be notified when this changes?

But depending on who you want listening to this I suppose you could do away
with the whole listener/metadata thing and just have your basepage call some
trigger method onRender that would do some work?

-R

On Mon, Mar 1, 2010 at 5:31 AM, Martin Asenov <mA...@velti.com> wrote:

> Hello, everyone!
>
> I was wondering if there's a way to know for instance if the user is on a
> page is there an event fired that indicates that the user is no longer on
> this page. I saw the method 'onRedirect()', but it's fired when the user
> comes to the page. I want to know when the user changes the page.
>
> Thanks in advance!
>
> Regards,
> Martin
>
>

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


Re: How can i know when a users redirects to other page

Posted by Riyad Kalla <rk...@gmail.com>.
Martin can you explain your use-case, namely what is the importance of
seeing which page a user is no-longer on?

Seems like a super-easy way to do this would be to extend a base-page that
updates a Session metadata element with the current page the user is on and
allow a listener to be notified when this changes?

But depending on who you want listening to this I suppose you could do away
with the whole listener/metadata thing and just have your basepage call some
trigger method onRender that would do some work?

-R

On Mon, Mar 1, 2010 at 5:31 AM, Martin Asenov <mA...@velti.com> wrote:

> Hello, everyone!
>
> I was wondering if there's a way to know for instance if the user is on a
> page is there an event fired that indicates that the user is no longer on
> this page. I saw the method 'onRedirect()', but it's fired when the user
> comes to the page. I want to know when the user changes the page.
>
> Thanks in advance!
>
> Regards,
> Martin
>
>