Lukáš Fryč created RF-12095:
-------------------------------
Summary: Incorrect behavior of two pushes on the page
Key: RF-12095
URL:
https://issues.jboss.org/browse/RF-12095
Project: RichFaces
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: component-push/poll
Affects Versions: 4.2.0.Final
Reporter: Lukáš Fryč
When you have 2 pushes on the page and one is conditionally rendered, rerendering it
causes unsubscribing of second push:
{code:xml}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j">
<f:view>
<h:head>
</h:head>
<h:body>
<h:form>
<br /><br /><br /><br />
<!-- PUSH 1 -->
<a4j:commandButton value="Push 1!"
action="#{richBean.push}" />
<a4j:outputPanel id="pushPanel">
<a4j:push id="push" rendered="#{not pushDisabled}"
address="sampleAddress"
ondataavailable="$('*[id$=outputDate]').text(event.rf.data)"
onsubscribed="alert('subscribed')" />
</a4j:outputPanel>
<a4j:outputPanel id="pushDisablementPanel">
<h:selectBooleanCheckbox value="#{pushDisabled}">
<a4j:ajax render="pushPanel pushDisablementPanel" />
</h:selectBooleanCheckbox>
<h:outputText value="#{pushDisabled ? 'disabled' :
'enabled'}" />
</a4j:outputPanel>
<br />
<a4j:outputPanel id="outputDate">
#{richBean.date}
</a4j:outputPanel>
<br />
<!-- PUSH 2 -->
<a4j:commandButton value="Push 2!"
action="#{richBean.push2}" />
<a4j:push id="push2" address="sampleAddress2"
ondataavailable="$('*[id$=outputDate2]').text(event.rf.data)"
onsubscribed="alert('subscribed2')" />
<br />
<a4j:outputPanel id="outputDate2">
#{richBean.date}
</a4j:outputPanel>
</h:form>
</h:body>
</f:view>
</html>
{code}
{code:java}
@ManagedBean
public class RichBean {
public Date getDate() {
return new Date();
}
public void push() throws MessageException {
TopicKey topicKey = new TopicKey("sampleAddress");
TopicsContext topicsContext = TopicsContext.lookup();
topicsContext.publish(topicKey, new Date().toString());
System.out.println("push event");
}
public void push2() throws MessageException {
TopicKey topicKey = new TopicKey("sampleAddress2");
TopicsContext topicsContext = TopicsContext.lookup();
topicsContext.publish(topicKey, new Date().toString());
System.out.println("push event 2");
}
}
{code}
Steps to reproduce:
1. open the page
2. you can see "subscribed" and "subscribed2" alert messages
3. both, Push! and Push 2! buttons reloads respective dates
4. click on checkbox and on the right of Push! button
EXPECTED: only Push! should stop to work
ACTUAL: both Push! and Push 2! stops to work
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira