2 Replies Latest reply on Aug 14, 2008 10:57 AM by Jessie Crowe

    a4j:push

    Chua Khoon Yong Novice

      hi any1,

      I was considering to use a4j:push for updating a web page. The consideration is to reduce network traffic overhead but still give real time response to user. But the developer guide description for a4j:push says that it "periodically perform Ajax request to server, to simulate 'push' data."

      Further reading the guide and tracing the source, it look similar to a a4j:poll but with some improvement in network load, as far as network traffic is concerned. I was a bit surprise on why a4j:push is being implemented in this manner?


      My questions are:

      Is it possible to implement real server push?

      or is there further improvement to a4j:push in future release?

      or this method of a4j:push is a good implementation, as compared to ICEFACES?

      Hope to gain more insights into this.
      Thank you.

        • 1. Re: a4j:push
          Chua Khoon Yong Novice

          hi every1,

          Was looking at the code for a4j:push again, and wondering if it is possible to implement ajax push by long polling. See this website for the meaning:

          http://weblogs.java.net/blog/jfarcand/archive/2007/05/new_adventures.html

          It may be possible to do long polling by extending the BaseFilter.java, see existing code snippet below:

          Sorry, i am not familiar on how to modify functionality to the richfaces sources.

          Any advices any1 on how to do this long polling ?
          Thanks.

          if (request.getAttribute(FILTER_PERFORMED) != Boolean.TRUE) {
           // mark - and not processing same request twice.
           try {
           request.setAttribute(FILTER_PERFORMED, Boolean.TRUE);
           String ajaxPushHeader = httpServletRequest
           .getHeader(AJAX_PUSH_KEY_HEADER);
           // check for a push check request.
           if (httpServletRequest.getMethod().equals("HEAD")
           && null != ajaxPushHeader) {
           PushEventsCounter listener = eventsManager
           .getListener(ajaxPushHeader);
           // To avoid XmlHttpRequest parsing exceptions.
           httpServletResponse.setContentType("text/plain");
           if (listener.isPerformed()) {
           listener.processed();
           httpServletResponse.setStatus(HttpServletResponse.SC_OK);
           httpServletResponse.setHeader(AJAX_PUSH_STATUS_HEADER, AJAX_PUSH_READY);
           if (log.isDebugEnabled()) {
           log.debug("Occurs event for a id " + ajaxPushHeader);
           }
           } else {
           // Response code - 'No content'
           httpServletResponse.setStatus(HttpServletResponse.SC_ACCEPTED);
           if (log.isDebugEnabled()) {
           log.debug("No event for a id " + ajaxPushHeader);
           }
          
          


          • 2. Re: a4j:push
            Jessie Crowe Newbie

            I am also interested in this topic. Since I am working on a large-scale commercial application, I am worried about the performance of the a4j:push tag. Can anyone speak to load tests or anything like that for this tag? Specifically I would like to see comparisons between a4j:push and the older a4j:poll tag.