Re: Antibot Form Submission Composite Behavior

2015-08-11 Thread Martin Grigorov
Hi,

I'd recommend you to read
https://developers.google.com/webmasters/control-crawl-index/docs/robots_txt
.
I guess it is possible to disable the bot partially or completely.

About your behavior: it should contribute a JS file similar to this:
$(function() {
  var loadTime, focusTime, submitTime;

  $(window).load(function() {loadTime = Date();})

  $('input, select, textarea').focus(function() {focusTime = Date()});

  $('form').submit(function(){
 submitTime = Date();

 return isEverythingOk(loadTime, focusTime, submitTime);
  });

})


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Aug 10, 2015 at 3:38 PM, Simon B simon.bott...@gmail.com wrote:

 Hi,

 I want to add a behavior to a Form object that helps stop bots successfully
 submitting the form.

 In order to do this I've come up with the following idea.

 Get a timestamp of when the web page loads
 Get a timestamp of when the form first receives user focus
 Get a timestamp of when the submit button is clicked

 With that information so long as there is a reasonable time difference
 between the three timestamps then allow the form to be submitted, if not
 then add a form error .

 I'm a bit unsure about how to go about implementing this, but was thinking
 about creating an AntibotBehaviour that I could add to a a form, the
 AntibotBehavior would wrap other AjaxEventBehaviors pinging the
 AntibotBehavior for each event (page load, form focus, form submission).

 Does anyone have an example of a behavior that I look at to base my
 implementation on.

 Alternatively does anyone have an Antibot behavior that they could show me?

 Cheers
 Simon

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Antibot-Form-Submission-Composite-Behavior-tp4671760.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: AtmosphereBehavior - hard reference to page object

2015-08-11 Thread Daniel Stoch
Hi,

AtmosphereBehavior extends AbstractAjaxBehavior which has a component
field - so this holds a reference to a component, so also to its page
(using parent relationships). AtmosphereBehavior in onRequest() method
registers itself as a listener to Meteor object:

  ...
  Meteor meteor = Meteor.build(request.getContainerRequest());
  // Add us to the listener list.
  meteor.addListener(this);
  ...

So until atmosphere resource hold in meteor expires, it keeps a hard
reference to our behavior so also to a page. It can be a problem in
heavy load applications (with many users), where many atmosphere
resources are created.

--
Daniel

On Mon, Aug 10, 2015 at 1:38 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 Can you point in the code where this happens?

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Mon, Aug 10, 2015 at 11:34 AM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 Ok, EventBus stores only pageId. But Atmosphere framework keeps all
 AtmosphereResourceEventListeners which are implemented by
 AtmosphereBehavior - so I think this is a place when Atmosphere keeps
 references to all registered pages.

 --
 Daniel


 On Tue, Jul 28, 2015 at 9:33 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  I see no problem here.
  Wicket-Atmosphere keeps the pageId, not the page:
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventBus.java#L253
 
  Later uses it at
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java#L76
 
  Martin Grigorov
  Freelancer. Available for hire!
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Jul 20, 2015 at 1:54 PM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  In Wicket (AFAIK) we keeps only actual page reference in a web
  session, all other pages as serialized to a page store.
  AtmosphereBehavior registers itself as a listener to
  AtmosphereResource object. Because of this Atmosphere keeps references
  to all registered pages (until such resource expires). I think it
  could be a problem in high load applications: theses hard references
  could eat all memory.
 
  What do you think: is it a problem or not (and I am wrong in this case)?
 
  --
  Best regards,
  Daniel
 
  -
  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



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



Re: AtmosphereBehavior - hard reference to page object

2015-08-11 Thread Martin Grigorov
Thanks!

Do you want to contribute an improvement?
For example we can extract a class that will be listener. In its onXyz()
callbacks it will use the pageId to lookup the page, then it will search
for an AtmosphereBehavior in the page to do its job (if this is required).

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Aug 11, 2015 at 1:20 PM, Daniel Stoch daniel.st...@gmail.com
wrote:

 Hi,

 AtmosphereBehavior extends AbstractAjaxBehavior which has a component
 field - so this holds a reference to a component, so also to its page
 (using parent relationships). AtmosphereBehavior in onRequest() method
 registers itself as a listener to Meteor object:

   ...
   Meteor meteor = Meteor.build(request.getContainerRequest());
   // Add us to the listener list.
   meteor.addListener(this);
   ...

 So until atmosphere resource hold in meteor expires, it keeps a hard
 reference to our behavior so also to a page. It can be a problem in
 heavy load applications (with many users), where many atmosphere
 resources are created.

 --
 Daniel

 On Mon, Aug 10, 2015 at 1:38 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  Can you point in the code where this happens?
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Aug 10, 2015 at 11:34 AM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  Ok, EventBus stores only pageId. But Atmosphere framework keeps all
  AtmosphereResourceEventListeners which are implemented by
  AtmosphereBehavior - so I think this is a place when Atmosphere keeps
  references to all registered pages.
 
  --
  Daniel
 
 
  On Tue, Jul 28, 2015 at 9:33 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
   Hi,
  
   I see no problem here.
   Wicket-Atmosphere keeps the pageId, not the page:
  
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventBus.java#L253
  
   Later uses it at
  
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java#L76
  
   Martin Grigorov
   Freelancer. Available for hire!
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Mon, Jul 20, 2015 at 1:54 PM, Daniel Stoch daniel.st...@gmail.com
 
   wrote:
  
   Hi,
  
   In Wicket (AFAIK) we keeps only actual page reference in a web
   session, all other pages as serialized to a page store.
   AtmosphereBehavior registers itself as a listener to
   AtmosphereResource object. Because of this Atmosphere keeps
 references
   to all registered pages (until such resource expires). I think it
   could be a problem in high load applications: theses hard references
   could eat all memory.
  
   What do you think: is it a problem or not (and I am wrong in this
 case)?
  
   --
   Best regards,
   Daniel
  
   -
   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
 
 

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




Re: AtmosphereBehavior - hard reference to page object

2015-08-11 Thread Daniel Stoch
Ok, I will try to prepare a fix for this. Then I will create a JIRA
issue for this with this fix.

--
Daniel

On Tue, Aug 11, 2015 at 12:55 PM, Martin Grigorov mgrigo...@apache.org wrote:
 Thanks!

 Do you want to contribute an improvement?
 For example we can extract a class that will be listener. In its onXyz()
 callbacks it will use the pageId to lookup the page, then it will search
 for an AtmosphereBehavior in the page to do its job (if this is required).

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Tue, Aug 11, 2015 at 1:20 PM, Daniel Stoch daniel.st...@gmail.com
 wrote:

 Hi,

 AtmosphereBehavior extends AbstractAjaxBehavior which has a component
 field - so this holds a reference to a component, so also to its page
 (using parent relationships). AtmosphereBehavior in onRequest() method
 registers itself as a listener to Meteor object:

   ...
   Meteor meteor = Meteor.build(request.getContainerRequest());
   // Add us to the listener list.
   meteor.addListener(this);
   ...

 So until atmosphere resource hold in meteor expires, it keeps a hard
 reference to our behavior so also to a page. It can be a problem in
 heavy load applications (with many users), where many atmosphere
 resources are created.

 --
 Daniel

 On Mon, Aug 10, 2015 at 1:38 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Hi,
 
  Can you point in the code where this happens?
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Mon, Aug 10, 2015 at 11:34 AM, Daniel Stoch daniel.st...@gmail.com
  wrote:
 
  Hi,
 
  Ok, EventBus stores only pageId. But Atmosphere framework keeps all
  AtmosphereResourceEventListeners which are implemented by
  AtmosphereBehavior - so I think this is a place when Atmosphere keeps
  references to all registered pages.
 
  --
  Daniel
 
 
  On Tue, Jul 28, 2015 at 9:33 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
   Hi,
  
   I see no problem here.
   Wicket-Atmosphere keeps the pageId, not the page:
  
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventBus.java#L253
  
   Later uses it at
  
 
 https://github.com/apache/wicket/blob/3eba671c0770b0167f2d83ebf8924b28917316c9/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/AtmosphereRequestHandler.java#L76
  
   Martin Grigorov
   Freelancer. Available for hire!
   Wicket Training and Consulting
   https://twitter.com/mtgrigorov
  
   On Mon, Jul 20, 2015 at 1:54 PM, Daniel Stoch daniel.st...@gmail.com
 
   wrote:
  
   Hi,
  
   In Wicket (AFAIK) we keeps only actual page reference in a web
   session, all other pages as serialized to a page store.
   AtmosphereBehavior registers itself as a listener to
   AtmosphereResource object. Because of this Atmosphere keeps
 references
   to all registered pages (until such resource expires). I think it
   could be a problem in high load applications: theses hard references
   could eat all memory.
  
   What do you think: is it a problem or not (and I am wrong in this
 case)?
  
   --
   Best regards,
   Daniel
  
   -
   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
 
 

 -
 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