3 Replies Latest reply on Mar 22, 2010 7:35 AM by Ilya Shaikovsky

    a4j:poll

    adi katz Newbie

      Hi all,

       

      I have a problem in which my poll component get a HTTP 500 error reply but nevertheless keep pinging the server each <interval>.

      Is there a way to stop the poll going when HTTP response code is other than 200 ?

      Make sense that this will be easily available in the component.

       

      Thanks for your help

      Adi ( previously k.a. shandor  - who lost his password and the answer to the security question... )

        • 1. Re: a4j:poll
          Ilya Shaikovsky Master

          use A4J.AJAX.OnError handler and stop poll via api http://community.jboss.org/wiki/AjaxCoreComponents#stoppolling

          1 of 1 people found this helpful
          • 2. Re: a4j:poll
            adi katz Newbie

            Hi,

             

            Thanks for your reply. From some reason this still does not work for me. Here is my code:

             

            Error catching code:

             

            A4J.AJAX.onError = function(req, status, message){
                        A4J.AJAX.StopPoll('#{rich:clientId('_pulse')}');
                        alert('hello');
                    }

             

             

             

            Poll code:

             

            <a4j:region id="_rgn_pulse">
                  <a4j:poll id="_pulse" immediate="true" enabled="#{initParam['easa.client.web.heartbeat']>0}" interval="5000"
                             reRender="_pulse" limitToList="true" action="#{easap.pulse}"/>
            </a4j:region>

             

             

            The way I test it is by shutting down my server while the web page is active. The A4J.AJAX.onError is immediately called but it is kept being called repeatdly, as if the poll is still active...

             

            Any suggestions ?

             

            Thanks

            Adi

            • 3. Re: a4j:poll
              Ilya Shaikovsky Master

              if there are any js errors?