1 Reply Latest reply on Dec 5, 2008 4:45 PM by alexsmirnov

    Ajax request never returns

    tomzi

      Hi there

      We have the problem if we start a jsf action eg using a a4j actionListener call to the backend and a reRender of some component that last more than 40 seconds that (a 'Please Wait' Layer will be displayed until the ajax request usually returns) that the ajax request never returns.

      We can see that the backend finishes fine, only the ajax request never returns. It seems that some firewall (which we don't have under control) just terminates the connection, probably seeing that nothing has been transfered over the A4j request for a while. Therefore the 'Please Wait layer' never disappears.

      My question is, is there a way to send keep alive messages over the same Ajax connection, with no action associated, just to make the connection not terminate until the backend finishes?

      I know other solutions may include polling and so on, but the above one may be the cleanest one.

        • 1. Re: Ajax request never returns
          alexsmirnov

          Better solution for long-running operations is asynchronous calls, with some kind of push solution ( RichFaces has the push component too ). Each long-running connection takes a lot of server resources. Many of firewall and proxy solutions break inactive connections, as you can see.
          If you ever want to keep connection active, you can write your own filter for this purpose. That filter have to be first in the filter chain and should start separate thread which will send keep-alive messages every few seconds.
          Because HTTP response headers, including content type and status code, have to be sent before a response body, this filter should send they itself and block any future attempts to change response parameters.
          There are some other requirements for the such solution. Using asynchronous processing looks even simplest.