Re: Link to Wicket page from Javascript

2014-03-17 Thread Martin Grigorov
Hi,

On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Hi,

 I would implement this as..

 1- A JS function that counts how much time has passed since last AJAX
 request. Once a certain threshold is passed an AJAX request is sent to the
 page.
 2- An AbstractAjaxBehavior that is added to the page. I would use it as
 context for AJAX request on 1).


at that time the session should be already expired.

But this can be used to do what is needed here - Wicket will redirect to
the configured PageExpiredErrorPage.


 3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage and
 invalidate the session.



 On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi brlom...@gmail.com
 wrote:

  Hi,
 
 
 
  An earlier question I asked about session timeouts was answered by Martin
  Grigorov. I am implementing his suggestion and have a JQuery script  what
  sets a timer that times out after a certain period of inactivity. The
  timeout triggers a function call.  Currently,  for a quick test,  I have
  that function use location.href to go to an arbitrary static web page
 like
  this:
 
 
 
  function whenUserIdle(){
 
  location.href = 'http://www.natural-environment.com';
 
  }
 
 
 
  That works fine, but now I need to make it go to a Wicket page in my
  application, similar to what would happen if I had an anchor tag like:
 
 
 
  a wicket:id= SessionTimeoutPage href=#SessionTimeoutPage/a
 
 
 
  But I can't figure out how to do this in the javascript function. Can
  anyone
  tell me how to call the Wicket page from the javascript function?


You can use script wicket:id=expirationUrl/script and a
Label(expirationUrl, window.expirePageUrl =' +
urlFor(SessionTimeoutPage.class) + ';);
Then use it with: location.href = window.expirePageUrl';


  
 
 
  Thanks,
 
 
 
  Bruce
 
 


 --
 Regards - Ernesto Reinaldo Barreiro



Re: Link to Wicket page from Javascript

2014-03-17 Thread Ernesto Reinaldo Barreiro
Martin,

What I mean is something that triggers the sign out before serve side
session expires... and trigger this expire event.

https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java
https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js

The above seem to work. You use it as in

https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java




On Mon, Mar 17, 2014 at 9:11 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

  Hi,
 
  I would implement this as..
 
  1- A JS function that counts how much time has passed since last AJAX
  request. Once a certain threshold is passed an AJAX request is sent to
 the
  page.
  2- An AbstractAjaxBehavior that is added to the page. I would use it as
  context for AJAX request on 1).
 

 at that time the session should be already expired.

 But this can be used to do what is needed here - Wicket will redirect to
 the configured PageExpiredErrorPage.


  3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage and
  invalidate the session.
 
 
 
  On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi brlom...@gmail.com
  wrote:
 
   Hi,
  
  
  
   An earlier question I asked about session timeouts was answered by
 Martin
   Grigorov. I am implementing his suggestion and have a JQuery script
  what
   sets a timer that times out after a certain period of inactivity. The
   timeout triggers a function call.  Currently,  for a quick test,  I
 have
   that function use location.href to go to an arbitrary static web page
  like
   this:
  
  
  
   function whenUserIdle(){
  
   location.href = 'http://www.natural-environment.com';
  
   }
  
  
  
   That works fine, but now I need to make it go to a Wicket page in my
   application, similar to what would happen if I had an anchor tag like:
  
  
  
   a wicket:id= SessionTimeoutPage href=#SessionTimeoutPage/a
  
  
  
   But I can't figure out how to do this in the javascript function. Can
   anyone
   tell me how to call the Wicket page from the javascript function?
 

 You can use script wicket:id=expirationUrl/script and a
 Label(expirationUrl, window.expirePageUrl =' +
 urlFor(SessionTimeoutPage.class) + ';);
 Then use it with: location.href = window.expirePageUrl';


   
  
  
   Thanks,
  
  
  
   Bruce
  
  
 
 
  --
  Regards - Ernesto Reinaldo Barreiro
 




-- 
Regards - Ernesto Reinaldo Barreiro


Re: Link to Wicket page from Javascript

2014-03-17 Thread Ernesto Reinaldo Barreiro
You can see it at work here

http://107.170.4.97:9080/client-sign-out-demo/


On Mon, Mar 17, 2014 at 9:18 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 Martin,

 What I mean is something that triggers the sign out before serve side
 session expires... and trigger this expire event.


 https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java

 https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js

 The above seem to work. You use it as in


 https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java




 On Mon, Mar 17, 2014 at 9:11 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:

  Hi,
 
  I would implement this as..
 
  1- A JS function that counts how much time has passed since last AJAX
  request. Once a certain threshold is passed an AJAX request is sent to
 the
  page.
  2- An AbstractAjaxBehavior that is added to the page. I would use it as
  context for AJAX request on 1).
 

 at that time the session should be already expired.

 But this can be used to do what is needed here - Wicket will redirect to
 the configured PageExpiredErrorPage.


  3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage
 and
  invalidate the session.
 
 
 
  On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi brlom...@gmail.com
  wrote:
 
   Hi,
  
  
  
   An earlier question I asked about session timeouts was answered by
 Martin
   Grigorov. I am implementing his suggestion and have a JQuery script
  what
   sets a timer that times out after a certain period of inactivity. The
   timeout triggers a function call.  Currently,  for a quick test,  I
 have
   that function use location.href to go to an arbitrary static web page
  like
   this:
  
  
  
   function whenUserIdle(){
  
   location.href = 'http://www.natural-environment.com';
  
   }
  
  
  
   That works fine, but now I need to make it go to a Wicket page in my
   application, similar to what would happen if I had an anchor tag like:
  
  
  
   a wicket:id= SessionTimeoutPage href=#SessionTimeoutPage/a
  
  
  
   But I can't figure out how to do this in the javascript function. Can
   anyone
   tell me how to call the Wicket page from the javascript function?
 

 You can use script wicket:id=expirationUrl/script and a
 Label(expirationUrl, window.expirePageUrl =' +
 urlFor(SessionTimeoutPage.class) + ';);
 Then use it with: location.href = window.expirePageUrl';


   
  
  
   Thanks,
  
  
  
   Bruce
  
  
 
 
  --
  Regards - Ernesto Reinaldo Barreiro
 




 --
 Regards - Ernesto Reinaldo Barreiro




-- 
Regards - Ernesto Reinaldo Barreiro


Re: Link to Wicket page from Javascript

2014-03-17 Thread Bruce Lombardi
Thanks, tis is very helpful.

Bruce

Sent from my iPad

 On Mar 17, 2014, at 4:52 AM, Ernesto Reinaldo Barreiro reier...@gmail.com 
 wrote:
 
 You can see it at work here
 
 http://107.170.4.97:9080/client-sign-out-demo/
 
 
 On Mon, Mar 17, 2014 at 9:18 AM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:
 
 Martin,
 
 What I mean is something that triggers the sign out before serve side
 session expires... and trigger this expire event.
 
 
 https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java
 
 https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js
 
 The above seem to work. You use it as in
 
 
 https://github.com/reiern70/antilia-bits/blob/master/client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java
 
 
 
 
 On Mon, Mar 17, 2014 at 9:11 AM, Martin Grigorov mgrigo...@apache.orgwrote:
 
 Hi,
 
 On Fri, Mar 14, 2014 at 9:25 PM, Ernesto Reinaldo Barreiro 
 reier...@gmail.com wrote:
 
 Hi,
 
 I would implement this as..
 
 1- A JS function that counts how much time has passed since last AJAX
 request. Once a certain threshold is passed an AJAX request is sent to
 the
 page.
 2- An AbstractAjaxBehavior that is added to the page. I would use it as
 context for AJAX request on 1).
 
 at that time the session should be already expired.
 
 But this can be used to do what is needed here - Wicket will redirect to
 the configured PageExpiredErrorPage.
 
 
 3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage
 and
 invalidate the session.
 
 
 
 On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi brlom...@gmail.com
 wrote:
 
 Hi,
 
 
 
 An earlier question I asked about session timeouts was answered by
 Martin
 Grigorov. I am implementing his suggestion and have a JQuery script
 what
 sets a timer that times out after a certain period of inactivity. The
 timeout triggers a function call.  Currently,  for a quick test,  I
 have
 that function use location.href to go to an arbitrary static web page
 like
 this:
 
 
 
 function whenUserIdle(){
 
location.href = 'http://www.natural-environment.com';
 
 }
 
 
 
 That works fine, but now I need to make it go to a Wicket page in my
 application, similar to what would happen if I had an anchor tag like:
 
 
 
 a wicket:id= SessionTimeoutPage href=#SessionTimeoutPage/a
 
 
 
 But I can't figure out how to do this in the javascript function. Can
 anyone
 tell me how to call the Wicket page from the javascript function?
 
 You can use script wicket:id=expirationUrl/script and a
 Label(expirationUrl, window.expirePageUrl =' +
 urlFor(SessionTimeoutPage.class) + ';);
 Then use it with: location.href = window.expirePageUrl';
 
 
 
 
 
 Thanks,
 
 
 
 Bruce
 
 
 --
 Regards - Ernesto Reinaldo Barreiro
 
 
 
 --
 Regards - Ernesto Reinaldo Barreiro
 
 
 
 -- 
 Regards - Ernesto Reinaldo Barreiro

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



Re: Link to Wicket page from Javascript

2014-03-16 Thread Ernesto Reinaldo Barreiro
Hi,


On Fri, Mar 14, 2014 at 8:44 PM, Bruce Lombardi brlom...@gmail.com wrote:

 Thanks Ernesto,  I was hoping for something simpler since what I have now
 with a simple Jquery timer does everything I need except go the the
 SessionTimeoutPage, where I would, as you suggest, invalidate the session.
 I'm sure your solution would work, but I'm not familiar enough with
 AbstractAjaxBehavior to implement it easily and the examples I've seen look
 complicated.

 Sometimes it is more difficult to explain something than to do it... Hope
this helps

https://github.com/reiern70/antilia-bits/tree/master/client-sign-out-parent


-- 
Regards - Ernesto Reinaldo Barreiro


Re: Link to Wicket page from Javascript

2014-03-14 Thread Ernesto Reinaldo Barreiro
Hi,

I would implement this as..

1- A JS function that counts how much time has passed since last AJAX
request. Once a certain threshold is passed an AJAX request is sent to the
page.
2- An AbstractAjaxBehavior that is added to the page. I would use it as
context for AJAX request on 1).
3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage and
invalidate the session.



On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi brlom...@gmail.com wrote:

 Hi,



 An earlier question I asked about session timeouts was answered by Martin
 Grigorov. I am implementing his suggestion and have a JQuery script  what
 sets a timer that times out after a certain period of inactivity. The
 timeout triggers a function call.  Currently,  for a quick test,  I have
 that function use location.href to go to an arbitrary static web page like
 this:



 function whenUserIdle(){

 location.href = 'http://www.natural-environment.com';

 }



 That works fine, but now I need to make it go to a Wicket page in my
 application, similar to what would happen if I had an anchor tag like:



 a wicket:id= SessionTimeoutPage href=#SessionTimeoutPage/a



 But I can't figure out how to do this in the javascript function. Can
 anyone
 tell me how to call the Wicket page from the javascript function?



 Thanks,



 Bruce




-- 
Regards - Ernesto Reinaldo Barreiro


RE: Link to Wicket page from Javascript

2014-03-14 Thread Bruce Lombardi
Thanks Ernesto,  I was hoping for something simpler since what I have now
with a simple Jquery timer does everything I need except go the the
SessionTimeoutPage, where I would, as you suggest, invalidate the session.
I'm sure your solution would work, but I'm not familiar enough with
AbstractAjaxBehavior to implement it easily and the examples I've seen look
complicated.

Bruce

-Original Message-
From: Ernesto Reinaldo Barreiro [mailto:reier...@gmail.com] 
Sent: Friday, March 14, 2014 3:26 PM
To: users@wicket.apache.org
Subject: Re: Link to Wicket page from Javascript

Hi,

I would implement this as..

1- A JS function that counts how much time has passed since last AJAX
request. Once a certain threshold is passed an AJAX request is sent to the
page.
2- An AbstractAjaxBehavior that is added to the page. I would use it as
context for AJAX request on 1).
3- On the respond of AJAXBehavior you redirect to  SessionTimeoutPage and
invalidate the session.



On Fri, Mar 14, 2014 at 8:07 PM, Bruce Lombardi brlom...@gmail.com wrote:

 Hi,



 An earlier question I asked about session timeouts was answered by 
 Martin Grigorov. I am implementing his suggestion and have a JQuery 
 script  what sets a timer that times out after a certain period of 
 inactivity. The timeout triggers a function call.  Currently,  for a 
 quick test,  I have that function use location.href to go to an 
 arbitrary static web page like
 this:



 function whenUserIdle(){

 location.href = 'http://www.natural-environment.com';

 }



 That works fine, but now I need to make it go to a Wicket page in my 
 application, similar to what would happen if I had an anchor tag like:



 a wicket:id= SessionTimeoutPage href=#SessionTimeoutPage/a



 But I can't figure out how to do this in the javascript function. Can 
 anyone tell me how to call the Wicket page from the javascript 
 function?



 Thanks,



 Bruce




--
Regards - Ernesto Reinaldo Barreiro


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