Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-13592

a4j:push doesn't work after rendering

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 4.3.5
    • Fix Version/s: 4.3.7
    • Component/s: component-push/poll
    • Labels:
    • Environment:

      JBoss EAP 6.2
      Browser: Chrome 33.0.1750.154 and IE 8.0.7601.17514
      JSF 2.19, Richfaces 4.3.5

    • Sprint:
      4.3.7 Sprint 1

      Description

      I use rendered attribute to start/stop a4j:push component in example below. After rendering of a4j:push element the handling of incoming push messages is broken. In my simple example I set alert to notify about recieved message (see attached screenshot).

      View xhtml code:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets">
          <h:form>
              <a4j:outputPanel id="push-panel">
                  <a4j:push address="TEST_ADDRESS" ondataavailable="alert('event.rf.data=' + event.rf.data)"
                      rendered="#{testBean.enabled}"/>
              </a4j:outputPanel>
       
              <a4j:commandButton id="startBtn" value="Start Push" action="#{testBean.startPush}" render="push-panel"/>
       
              <a4j:commandButton id="stopBtn" value="Stop Push" action="#{testBean.stopPush}" render="push-panel"/>
       
              <a4j:commandButton id="sendMessage" value="Send Message" action="#{testBean.sendMessage}"/>
          </h:form>
      </ui:composition>

      Backing bean class:

      public class TestBean {
          private boolean enabled = false;
       
          public boolean isEnabled() {
              return enabled;
          }
       
          public void startPush() {
              enabled = true;
          }
       
          public void stopPush() {
              enabled = false;
          }
       
          public void sendMessage() throws MessageException {
              TopicsContext.lookup().publish(new TopicKey("TEST_ADDRESS"), "Hello World");
          }
       
      }

      Configuration in web.xml (see attachment).

      Scenario:
      1) Open page
      2) Click "Start Push" button
      3) Click "Send Message" button
      4) Alert "event.rf.data=Hello World" is shown (see attached screenshot)
      5) Click "Stop Push" button
      6) Polling is closed (see localhost.har in attachment)
      7) Click "Start Push" button
      8) Polling is started (see localhost.har in attachment)
      9) Click "Send Message" button
      10) Message is recieved (see localhost.har in attachment)
      11) No alert, no javascript error

      For more details I saved a4j:log output in a4j.log file.

        Gliffy Diagrams

          Attachments

          1. a4j.log
            11 kB
          2. localhost.har
            174 kB
          3. push-test.zip
            5 kB
          4. push-test.zip
            5 kB
          5. screenshot.png
            screenshot.png
            6 kB
          6. web.xml
            6 kB

            Issue Links

              Activity

                People

                • Assignee:
                  bleathem Brian Leathem
                  Reporter:
                  igor_ab Igor Bolshakov
                • Votes:
                  9 Vote for this issue
                  Watchers:
                  11 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 4 hours
                    4h
                    Remaining:
                    Remaining Estimate - 4 hours
                    4h
                    Logged:
                    Time Spent - Not Specified
                    Not Specified