<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Can I use PrimePush in Xpert.ivy?</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy</link><description>&lt;p&gt;I want to send messages from the Xpert.ivy server to a HTML Dialog, i.e. to JSF pages. &lt;a href="http://www.primefaces.org/showcase/push/"&gt;PrimePush&lt;/a&gt; supports this but is not yet integrated in Xpert.ivy. How can I use it anyways?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 26 Aug 2015 06:26:36 -0400</lastBuildDate><item><title>Comment by Hap Em on SupportIvyTeam's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1449</link><description>&lt;p&gt;Hello Flavio!&lt;/p&gt;
&lt;p&gt;I want to test &lt;em&gt;before and after&lt;/em&gt; I apply &lt;em&gt;useWebSocketAndServlet3&lt;/em&gt; into Ivy Engine.&lt;/p&gt;
&lt;p&gt;So, Pls give me some information:
 - Where is MaxThreadCount defined?
 - How can I test MaxThreadCount is reached? (Do you have a monitor tool to or test tool?&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards,&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Wed, 26 Aug 2015 06:26:36 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1449</guid></item><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1282</link><description>&lt;p&gt;I mean we should look for a more intuitive way where we do not have to copy classes around the designer and server as this is very unflexible, difficult for deployment. And of course the endpoint is always global instead of local for one pmv.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Thu, 23 Apr 2015 08:40:27 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1282</guid></item><item><title>Comment by Hap Em on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1281</link><description>&lt;p&gt;Yes. The Endpoints have registered programmatically when the server/designer started. By default, It'll find all classes having @PushEndpoint in WEB-INF/classes.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Thu, 23 Apr 2015 04:03:23 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1281</guid></item><item><title>Comment by Hap Em on Hap Em's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1280</link><description>&lt;p&gt;We need to do one more step to create Endpoint java class.
For example:
package ch.soreco.primepush.endpoints;
import org.primefaces.push.annotation.OnMessage;
import org.primefaces.push.annotation.PushEndpoint;
import org.primefaces.push.impl.JSONEncoder;
@PushEndpoint("/chat")
public class ChatResource {
    @OnMessage(encoders = { JSONEncoder.class })
    public String onMessage(String msg) {
        return msg;
    }
}&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Compile this java file to class file&lt;/li&gt;
&lt;li&gt;Copy this class file to {Ivy_Server_Folder}\webapps\ivy\WEB-INF\classes.....\ChatResource.class&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Thu, 23 Apr 2015 03:48:14 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1280</guid></item><item><title>Comment by Reguel Wermelinger on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1275</link><description>&lt;p&gt;Thanks for your reply. I guess that the endpoint can also be registered programatically. But i do not have the time at the moment to find out how. But if you inspect the code in the "AtmosphereFramework" class you should get an idea.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 22 Apr 2015 09:26:04 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1275</guid></item><item><title>Comment by Hap Em on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1273</link><description>&lt;p&gt;Thanks for your solution!&lt;/p&gt;
&lt;p&gt;After doing a lot of research on internet and make the same demo in eclipse as well to know about mechanism of primepush and atmosphere.
--&amp;gt; Yesterday, I have found out the solution (same your solution) in Ivy Designer.
and It works correctly now.&lt;/p&gt;
&lt;p&gt;Thanks again!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Wed, 22 Apr 2015 06:27:44 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#1273</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/1272</link><description>&lt;p&gt;&lt;strong&gt;Answers for Axon.ivy 5.1 (Lauberhorn) with Primefaces 5.0&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;See &lt;a href="https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/11"&gt;answers for Xpert.ivy 5.0 (Rothorn) with Primefaces 3.5&lt;/a&gt; if you use an older version.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;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 &lt;a href="http://www.primefaces.org/docs/guide/primefaces_user_guide_5_0.pdf#page=526&amp;amp;zoom=auto,56,773"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But basically primefaces push still works. There is an updated demo project here: &lt;a href="/upfiles/PrimePush_51.iar"&gt;PrimePush_51.iar&lt;/a&gt;. It can be set up as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the atmospehere-runtime jar (and optionally its sources) from a maven repository: &lt;a href="http://central.maven.org/maven2/org/atmosphere/atmosphere-runtime/2.1.3/atmosphere-runtime-2.1.3.jar"&gt;atomsphere-runtime.jar&lt;/a&gt;. I used the version 2.1.3 that is documented by Primefaces. But I think newer versions should work also.&lt;/li&gt;
&lt;li&gt;Copy the atmosphere JAR into your designer/webapps/ivy/WEB-INF/lib&lt;/li&gt;
&lt;li&gt;Adjust the web.xml in designer/webapps/ivy/WEB-INF/web.xml as documented in the first answer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;web.xml example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;servlet&amp;gt;
    &amp;lt;servlet-name&amp;gt;Push Servlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;servlet-class&amp;gt;org.primefaces.push.PushServlet&amp;lt;/servlet-class&amp;gt;
    &amp;lt;async-supported&amp;gt;true&amp;lt;/async-supported&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;org.atmosphere.useWebSocketAndServlet3&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
&amp;lt;/servlet&amp;gt;
&amp;lt;servlet-mapping&amp;gt;
    &amp;lt;servlet-name&amp;gt;Push Servlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;url-pattern&amp;gt;/primepush/*&amp;lt;/url-pattern&amp;gt;
&amp;lt;/servlet-mapping&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Write an endpoint bean for your channel. For instance a simple echo bean look like this: &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;endpoint example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;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;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;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&lt;/li&gt;
&lt;li&gt;Restart your Designer&lt;/li&gt;
&lt;li&gt;Import the PrimePush_51.iar demo project&lt;/li&gt;
&lt;li&gt;Run the Hello World example.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;category name="org.atmosphere.cpr.AtmosphereFramework" class="ch.ivyteam.log.Logger"&amp;gt;
    &amp;lt;priority value="INFO"/&amp;gt;
&amp;lt;/category&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 21 Apr 2015 09:08:32 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/1272</guid></item><item><title>Answer by Hap Em</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/1270</link><description>&lt;p&gt;Hello All,&lt;/p&gt;
&lt;p&gt;I have made a demo to use primepush on Ivy 5.1.4 and atmosphere 2.1.6.
When I started Ivy --&amp;gt; It showed an error:
13:08:34.123 ERROR [org.primefaces.push.PushServlet] [localhost-startStop-1] [] 
  No Annotated class using @PushEndpoint found. Push will not work.&lt;/p&gt;
&lt;p&gt;This is my code:&lt;/p&gt;
&lt;p&gt;xhtml page:
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" &amp;lt;br=""/&amp;gt;      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"&amp;gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;h:head&amp;gt;
    &amp;lt;title&amp;gt;JSF User Dialog&amp;lt;/title&amp;gt;
    &amp;lt;script&amp;gt;
        function onMessage(msg) {
            $('.display').html(msg);
        };
        function onError() {
            alert("error");
        };
    &amp;lt;/script&amp;gt;
&amp;lt;/h:head&amp;gt;
&amp;lt;h:body&amp;gt;
    &amp;lt;h:form&amp;gt;
        &amp;lt;h:outputText id="out" styleClass="ui-widget display" /&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
        &amp;lt;p:inputText required="true" value="#{data.message}" /&amp;gt;
        &amp;lt;p:commandButton value="Nachricht senden" actionListener="#{logic.SendMessage}" /&amp;gt;
    &amp;lt;/h:form&amp;gt;
    &amp;lt;p:socket channel="/chat" onMessage="onMessage" onMessagePublished="onMessage" transport="websocket" widgetVar="pfsocket" autoConnect="true" fallbackTransport="websocket"/&amp;gt;
&amp;lt;/h:body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;
&lt;p&gt;In SendMessage event:
JSONObject rs = new JSONObject();
rs.put("pfpd", String.valueOf("Nachricht: " + in.message));&lt;/p&gt;
&lt;p&gt;EventBusFactory.getDefault().eventBus().publish("/chat", rs);&lt;/p&gt;
&lt;p&gt;In web.xml:
&amp;lt;servlet&amp;gt;
        &amp;lt;servlet-name&amp;gt;Push Servlet&amp;lt;/servlet-name&amp;gt;
        &amp;lt;servlet-class&amp;gt;org.primefaces.push.PushServlet&amp;lt;/servlet-class&amp;gt;
        &amp;lt;init-param&amp;gt;
            &amp;lt;param-name&amp;gt;org.atmosphere.cpr.broadcasterCacheClass&amp;lt;/param-name&amp;gt;
            &amp;lt;param-value&amp;gt;org.atmosphere.cache.UUIDBroadcasterCache&amp;lt;/param-value&amp;gt;
        &amp;lt;/init-param&amp;gt;
        &amp;lt;init-param&amp;gt;
            &amp;lt;param-name&amp;gt;org.atmosphere.cpr.broadcasterClass&amp;lt;/param-name&amp;gt;
            &amp;lt;param-value&amp;gt;org.atmosphere.cpr.DefaultBroadcaster&amp;lt;/param-value&amp;gt;
        &amp;lt;/init-param&amp;gt;
        &amp;lt;init-param&amp;gt;
            &amp;lt;param-name&amp;gt;channels&amp;lt;/param-name&amp;gt;
            &amp;lt;param-value&amp;gt;chat&amp;lt;/param-value&amp;gt;
        &amp;lt;/init-param&amp;gt;
        &amp;lt;init-param&amp;gt;
            &amp;lt;param-name&amp;gt;org.atmosphere.useWebSocketAndServlet3&amp;lt;/param-name&amp;gt;
            &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
        &amp;lt;/init-param&amp;gt;
        &amp;lt;init-param&amp;gt;
            &amp;lt;param-name&amp;gt;org.atmosphere.cpr.SessionSupport&amp;lt;/param-name&amp;gt;
            &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
        &amp;lt;/init-param&amp;gt;
        &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;
        &amp;lt;async-supported&amp;gt;true&amp;lt;/async-supported&amp;gt;
    &amp;lt;/servlet&amp;gt;
    &amp;lt;servlet-mapping&amp;gt;
        &amp;lt;servlet-name&amp;gt;Push Servlet&amp;lt;/servlet-name&amp;gt;
        &amp;lt;url-pattern&amp;gt;/primepush/*&amp;lt;/url-pattern&amp;gt;
    &amp;lt;/servlet-mapping&amp;gt;&lt;/p&gt;
&lt;p&gt;When I sent a message to "chat" channels --&amp;gt; It's not working&lt;/p&gt;
&lt;p&gt;Pls help me if you have any idea!
Thanks in advance!
Regards,&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Mon, 20 Apr 2015 08:34:26 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/1270</guid></item><item><title>Comment by Flavio Sadeghi on SupportIvyTeam's answer</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#625</link><description>&lt;p&gt;I have just added the init-param 'org.atmosphere.useWebSocketAndServlet3'. This is required that non-IO blocking threads are used for AJP connections! (e.g. when Xpert.ivy is integrated with IIS). Otherwise each connection consumes a thread on the server side. As soon as the MaxThreadCount is reached (default value is 200) no more connection could be created and the server will no longer answer.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Thu, 10 Apr 2014 16:58:57 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy#625</guid></item><item><title>Answer by SupportIvyTeam</title><link>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/11</link><description>&lt;p&gt;&lt;strong&gt;Answers for Xpert.ivy 5.0 (Rothorn) with Primefaces 3.5&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;See &lt;a href="http://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/1272"&gt;answers for Axon.ivy 5.1 (Lauberhorn) with Primefaces 5.0&lt;/a&gt; if you use an older version.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are two steps to do. First you have to install the &lt;a href="https://github.com/Atmosphere/atmosphere"&gt;Atmosphere framework&lt;/a&gt; on which &lt;a href="http://www.primefaces.org/showcase/push/index.jsf"&gt;PrimePush&lt;/a&gt; is based on. Second you have to configure PrimePush to use it in Xpert.ivy.&lt;/p&gt;
&lt;p&gt;For the first step, Atmosphere unfortunately does not provide binary releases. So, please follow the instructions on the Atmosphere homepage to get the Atmosphere jar files. Then move them into the directory &lt;em&gt;webapps/Ivy/WEB-INF/lib&lt;/em&gt; of the Designer/Server.&lt;/p&gt;
&lt;p&gt;For the second step, please open the file &lt;em&gt;webapps/Ivy/WEB_INF/web.xml&lt;/em&gt;. Within the web-app tag, add the following text:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;servlet&amp;gt;
    &amp;lt;servlet-name&amp;gt;Push Servlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;servlet-class&amp;gt;org.primefaces.push.PushServlet&amp;lt;/servlet-class&amp;gt;
    &amp;lt;async-supported&amp;gt;true&amp;lt;/async-supported&amp;gt;
    &amp;lt;init-param&amp;gt;
        &amp;lt;param-name&amp;gt;org.atmosphere.useWebSocketAndServlet3&amp;lt;/param-name&amp;gt;
        &amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;
    &amp;lt;/init-param&amp;gt;
&amp;lt;/servlet&amp;gt;
&amp;lt;servlet-mapping&amp;gt;
    &amp;lt;servlet-name&amp;gt;Push Servlet&amp;lt;/servlet-name&amp;gt;
    &amp;lt;url-pattern&amp;gt;/primepush/*&amp;lt;/url-pattern&amp;gt;
&amp;lt;/servlet-mapping&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Re-start the Designer/Server. To check whether it works not, please use the &lt;a href="http://xpert-ivy-hacker-source-code.googlecode.com/svn/trunk/PrimePush"&gt;example project&lt;/a&gt; from the &lt;a href="http://blog.xpertivyhacker.ch/"&gt;Xpert.ivy Hacker&lt;/a&gt;. Start the process &lt;em&gt;PrimePush Hello World&lt;/em&gt;  in multiple browsers and type a message in one of the browsers. If everything is correct you should see the message posted to all browser windows. &lt;/p&gt;
&lt;p&gt;&lt;br&gt;
&lt;br&gt;
Note: This question and answer was &lt;a href="http://blog.xpertivyhacker.ch/2012/11/xpertivy-primepush-installieren.html"&gt;originally posted&lt;/a&gt; by Heinrich Spreiter on his &lt;a href="http://blog.xpertivyhacker.ch/"&gt;Xpert.ivy Hacker blog&lt;/a&gt;. Many thanks to Henry for his enthusiastic work. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SupportIvyTeam</dc:creator><pubDate>Mon, 07 Oct 2013 13:42:01 -0400</pubDate><guid>https://answers.axonivy.com/questions/10/can-i-use-primepush-in-xpert-ivy/11</guid></item></channel></rss>