**Answers for Axon.ivy 5.1 (Lauberhorn) with Primefaces 5.0**
- See [answers for Xpert.ivy 5.0 (Rothorn) with Primefaces 3.5][1] if you use an older version.
The usage of PrimePush has changed in many ways since ivy 5.1 as Primefaces has changed its implementation between primefaces 3.5 (ivy 5.0) and primefaces 5.0 (ivy 5.1). The documentation for Primefaces 5.0 with PrimePush is [here][2].
But basically primefaces push still works. There is an updated demo project here: [PrimePush_51.iar][3]. It can be set up as follows:
* Download the atmospehere-runtime jar (and optionally its sources) from a maven repository: [atomsphere-runtime.jar][4]. I used the version 2.1.3 that is documented by Primefaces. But I think newer versions should work also.
* Copy the atmosphere JAR into your designer/webapps/ivy/WEB-INF/lib
* Adjust the web.xml in designer/webapps/ivy/WEB-INF/web.xml as documented in the first answer
web.xml example:
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<async-supported>true</async-supported>
<init-param>
<param-name>org.atmosphere.useWebSocketAndServlet3</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
* Write an endpoint bean for your channel. For instance a simple echo bean look like this:
endpoint example:
package ch.ivyteam.test;
import org.primefaces.push.annotation.OnMessage;
import org.primefaces.push.annotation.PushEndpoint;
import org.primefaces.push.impl.JSONEncoder;
@PushEndpoint("/mychannel")
public class MessageResource {
@OnMessage(encoders = { JSONEncoder.class })
public String onMessage(String message)
{
return message;
}
}
* copy the resulting .class file with its parent package folders into designer/webapps/ivy/WEB-INF/classes directory. Or copy the existing from the demo.iar/classes_endpoints
* Restart your Designer
* Import the PrimePush_51.iar demo project
* Run the Hello World example.
If you still run into problem with atomsphere. It can help to get more log outputs form the atmosphere runtime jar. To do so copy the following xml into your designer/configuration/log4jconfig.xml:
<category name="org.atmosphere.cpr.AtmosphereFramework" class="ch.ivyteam.log.Logger">
<priority value="INFO"/>
</category>
[1]: http://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/11https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/11
[2]: http://www.primefaces.org/docs/guide/primefaces_user_guide_5_0.pdf#page=526&zoom=auto,56,773
[3]: http://developer.axonivy.com/q-and-a-attachments/PrimePush_51.iar/upfiles/PrimePush_51.iar
[4]: http://central.maven.org/maven2/org/atmosphere/atmosphere-runtime/2.1.3/atmosphere-runtime-2.1.3.jar