Re: How to tackle Ajax Flooding

2009-12-09 Thread smallufo
Wow , thanks for this great tip ...

But I have problem applying to Gmap2 :
I hope when user clicks the map , the map won't be able to receive any
requests until the onClick() finishes...
But it seems this doesn't work...
Is there anything I missed ?

gmap2.add(new ClickListener()
{
  @Override
  protected void onClick(AjaxRequestTarget target, GLatLng latLng, GOverlay
overlay)
  {
// high computation ...
  }

  @Override
  protected IAjaxCallDecorator getAjaxCallDecorator()
  {
return new IAjaxCallDecorator()
{
  @Override
  public CharSequence decorateScript(CharSequence script)
  { return this.enabled=false;+script; }

  @Override
  public CharSequence decorateOnSuccessScript(CharSequence script)
  { return script+;this.enabled=true;; }

  @Override
  public CharSequence decorateOnFailureScript(CharSequence script)
  { return script+;this.enabled=true;; }
};
  }
});



2009/8/31 Igor Vaynberg igor.vaynb...@gmail.com

 add(new ajaxbutton(button) {
  getajaxcalldecorator() {
 return new iajaxcalldecorator() {
 decoratescript(script) { return this.enabled=false;+script; }
 decorateonfailurescript(script) { return
 script+;this.enabled=true;;}
 decorateonsuccessscript(script) { return
 script+;this.enabled=true;;}
 }
  }
 }

 doesnt look like a lot of javascript to me. further you can factor it
 out into a separate class and reuse it all over the place.

 -igor


 On Mon, Aug 31, 2009 at 5:40 AM, Tom Wollerttom.woll...@googlemail.com
 wrote:
  The only idea I can come up with is to keep state of my model on client
  side, but that would require alot of javascript :/
 

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




Re: How to tackle Ajax Flooding

2009-08-31 Thread nino martinez wael
Is it something like this?

http://www.nabble.com/No-behavior-listener-found-td20325302.html

2009/8/30 Tom Wollert tom.woll...@googlemail.com:
 Hello there,

 I have a problem with my Wicket Application, which is quite Ajax heavy.
 Certain ajax calls take some time as they start an import, however the
 button can still be clicked and sends another ajax call (which is delayed
 for quite some time). Is it possible to disable the button while the request
 cycle is not complete? (I mean with wicket, or do I need to use
 Javascript?). Also ajax calls are postponed as long as the channel is busy,
 is it possible to deactivate this behaviour? And are there reasons why I
 should not?


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



Re: How to tackle Ajax Flooding

2009-08-31 Thread Tom Wollert
Thanks for the replies, so I have to write my own Javascript...  no problem
I guess, was hoping for a cleaner way so to speak.

Any idea about disabling the postponing when the ajax channel is busy?
Specifically I have on my website an area where the user sends multiple
requests in very rapid succession. The way it is now all the requests
simultaneously? Right now the responses come with an awkward delay right
now. Any idea how to solve this elegantly?

2009/8/31 nino martinez wael nino.martinez.w...@gmail.com

 Is it something like this?

 http://www.nabble.com/No-behavior-listener-found-td20325302.html

 2009/8/30 Tom Wollert tom.woll...@googlemail.com:
  Hello there,
 
  I have a problem with my Wicket Application, which is quite Ajax heavy.
  Certain ajax calls take some time as they start an import, however the
  button can still be clicked and sends another ajax call (which is delayed
  for quite some time). Is it possible to disable the button while the
 request
  cycle is not complete? (I mean with wicket, or do I need to use
  Javascript?). Also ajax calls are postponed as long as the channel is
 busy,
  is it possible to deactivate this behaviour? And are there reasons why I
  should not?
 

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




Re: How to tackle Ajax Flooding

2009-08-31 Thread Tom Wollert
The only idea I can come up with is to keep state of my model on client
side, but that would require alot of javascript :/


Re: How to tackle Ajax Flooding

2009-08-31 Thread nino martinez wael
Heh, the whole idea with ajax are that it are asynchronous :)

2009/8/31 Tom Wollert tom.woll...@googlemail.com:
 The only idea I can come up with is to keep state of my model on client
 side, but that would require alot of javascript :/


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



Re: How to tackle Ajax Flooding

2009-08-31 Thread Pedro Santos
- area where the user sends multiple requests in very rapid succession
- model on client side
- alot of javascript
Do you consider to choice an diferent framework for thi especific project?
Take a look at:
http://ptrthomas.wordpress.com/2008/09/04/wicket-and-gwt-compared-with-code/

On Mon, Aug 31, 2009 at 9:47 AM, nino martinez wael 
nino.martinez.w...@gmail.com wrote:

 Heh, the whole idea with ajax are that it are asynchronous :)

 2009/8/31 Tom Wollert tom.woll...@googlemail.com:
  The only idea I can come up with is to keep state of my model on client
  side, but that would require alot of javascript :/
 

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




Re: How to tackle Ajax Flooding

2009-08-31 Thread Igor Vaynberg
add(new ajaxbutton(button) {
  getajaxcalldecorator() {
 return new iajaxcalldecorator() {
 decoratescript(script) { return this.enabled=false;+script; }
 decorateonfailurescript(script) { return script+;this.enabled=true;;}
 decorateonsuccessscript(script) { return script+;this.enabled=true;;}
 }
  }
}

doesnt look like a lot of javascript to me. further you can factor it
out into a separate class and reuse it all over the place.

-igor


On Mon, Aug 31, 2009 at 5:40 AM, Tom Wollerttom.woll...@googlemail.com wrote:
 The only idea I can come up with is to keep state of my model on client
 side, but that would require alot of javascript :/


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



Re: How to tackle Ajax Flooding

2009-08-31 Thread Michael O'Cleirigh

Hi Tom,

It sounds like you are doing too much in your heavy Ajax requests.  You 
should consider changing how it works so that the process can be started 
by the Ajax request but does not need to block other ajax requests while 
waiting for the results.  You can use a progress bar to denote to the 
user that something is happening and then once the work is done allow 
them to access it (say through a link that is only visible when the 
request is completed).


Others have mentioned the javascript client side checks but I like the 
server side approach since all the context is already present to make 
the decision on what to do with the Ajax call.


Regards,

Mike



I have a problem with my Wicket Application, which is quite Ajax heavy.
Certain ajax calls take some time as they start an import, however the
button can still be clicked and sends another ajax call (which is delayed
for quite some time). Is it possible to disable the button while the request
cycle is not complete? (I mean with wicket, or do I need to use
Javascript?). Also ajax calls are postponed as long as the channel is busy,
is it possible to deactivate this behaviour? And are there reasons why I
should not?

  



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



Re: How to tackle Ajax Flooding

2009-08-31 Thread Jason Wang

Tom Wollert wrote:

Hello there,

I have a problem with my Wicket Application, which is quite Ajax heavy.
Certain ajax calls take some time as they start an import, however the
button can still be clicked and sends another ajax call (which is delayed
for quite some time). Is it possible to disable the button while the request
cycle is not complete? (I mean with wicket, or do I need to use
Javascript?). Also ajax calls are postponed as long as the channel is busy,
is it possible to deactivate this behaviour? And are there reasons why I
should not?

  
Normally I guess we do not want to do that (disabling all the other 
buttons ,etc). Often the reason we use ajax is to make the user requests 
handled asynchronysly. But for something that really critical like 
handling credit card payment, I think its still a good idea to disable 
any other actions on the same page.


I did not have this problem(flooding) myself, but I think you may 
consider using a event bus to tackle it. So all the ajax events are 
queued into the bus then handled by your server layer when it can. Plus 
you will have the benefits to have a centralized place to prioritize the 
events, doing some sort of load balancing.



Jason Wang



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



How to tackle Ajax Flooding

2009-08-30 Thread Tom Wollert
Hello there,

I have a problem with my Wicket Application, which is quite Ajax heavy.
Certain ajax calls take some time as they start an import, however the
button can still be clicked and sends another ajax call (which is delayed
for quite some time). Is it possible to disable the button while the request
cycle is not complete? (I mean with wicket, or do I need to use
Javascript?). Also ajax calls are postponed as long as the channel is busy,
is it possible to deactivate this behaviour? And are there reasons why I
should not?


Re: How to tackle Ajax Flooding

2009-08-30 Thread Igor Vaynberg
you can use an ajax call decorator to disable the button via
javascript when it is clicked.

-igor

On Sun, Aug 30, 2009 at 2:55 PM, Tom Wollerttom.woll...@googlemail.com wrote:
 Hello there,

 I have a problem with my Wicket Application, which is quite Ajax heavy.
 Certain ajax calls take some time as they start an import, however the
 button can still be clicked and sends another ajax call (which is delayed
 for quite some time). Is it possible to disable the button while the request
 cycle is not complete? (I mean with wicket, or do I need to use
 Javascript?). Also ajax calls are postponed as long as the channel is busy,
 is it possible to deactivate this behaviour? And are there reasons why I
 should not?


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