Real Time Progress bar with a blockUI doesn't work using primefaces whit with atmosphere
I have a button and when I press on it, the method obtains data from the data base and show the records in a datatable. The action takes more than 1 minute and I want to show a progress bar (the time is variable)
I found the solution in this page: [Show a real time progress bar in a Html User Dialog][1]
[1]: http://answers.axonivy.com/questions/16/show-a-real-time-progress-bar-in-a-html-user-dialog
The problem is that I show the progress bar, but always is "0%". In the javascript function never enter. And I don't know if I'm doing something wrong.
This is my XHTML: (I can't write the simbol 'is less than')
h:form id="formAllocate">
p:panel id="panel" header="Realtime ProgressBar">
p:commandButton id="btn" value="Start"
actionListener="#{scheduleMB.startLongRunningProcess}">
/p:commandButton>
/p:panel>
p:blockUI block="panel" trigger="btn">
p:progressBar widgetVar="progressBar" style="width:300px"
labelTemplate="{value}%">
/p:progressBar>
span id="msg"></span>
/p:blockUI>
/h:form>
p:socket channel="/realtime" onMessage="handleProgress"></p:socket>
script type="text/javascript">
function handleProgress(progressJson) {
alert('begin');
var progressData = eval("(" + progressJson + ")");
progressBar.setValue(progressData.progress);
$("#msg").text(progressData.msg);
}
/script>
This is my Bean:
public void startLongRunningProcess(){
EventBus eventBus = EventBusFactory.getDefault().eventBus();
eventBus.publish("/realtime", "{ 'progress' : 10, 'msg' : 'Extract data'}");
list =
getAuxService().findList(userSelected, initDate2,
endDate2);
}
In the web.xml:
servlet>
servlet-name>Push Servlet</servlet-name>
servlet-class>org.primefaces.push.PushServlet</servlet-class>
load-on-startup>1</load-on-startup>
async-supported>true</async-supported>
/servlet>
servlet-mapping>
servlet-name>Push Servlet</servlet-name>
url-pattern>/primepush/*</url-pattern>
/servlet-mapping>
In my pom.xml I have this dependencies:
dependency>
groupId>org.atmosphere</groupId>
artifactId>atmosphere-runtime</artifactId>
version>2.2.2</version>
/dependency>
dependency>
groupId>org.roboguice</groupId>
artifactId>roboguice</artifactId>
version>2.0</version>
/dependency>
I'm using primefaces 5.1, spring 3.2.5, hibernate 4.2.7, java 1.7, primefaces extension 3.0.0
What I'm doing wrong???
Thx for the help and answer.