| Author |
Message |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 09/08/2010 03:04:57
|
asif436
Joined: 19/12/2008 00:00:00
Messages: 17
Offline
|
Hi there,
I am trying to get the ajax push to work with the liferay but haven't been able to update multiple client browser running on different machine.
Please take a look @ the code and provide me some direction
---------------
faces.config
----------------
<managed-bean>
<managed-bean-name>renderMgr</managed-bean-name>
<managed-bean-class>
com.icesoft.faces.async.render.RenderManager
</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<!-- UserHomeBean-->
<managed-bean>
<managed-bean-name>HomeController</managed-bean-name>
<managed-bean-class>Some.package.name.controllers.HomeController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>renderManager</property-name>
<value>#{renderMgr}</value>
</managed-property>
</managed-bean>
-------------
web.xml
-------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<display-name>StreetMonitor</display-name>
<description>
A collection of portlets for finding and mapping locations that shows
how Ajax Push can be used to update multiple portlets.
</description>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD
</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.connectionTimeout</param-name>
<param-value>1200000</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.compressResources</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.portlet.hiddenAttributes</param-name>
<param-value>THEME_DISPLAY</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.blockingRequestHandler</param-name>
<param-value>push-server</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.localAddress</param-name>
<param-value>127.0.0.1</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.localPort</param-name>
<param-value>8080</param-value>
</context-param>
<listener>
<listener-class>
com.liferay.portal.kernel.servlet.PortletContextListener
</listener-class>
</listener>
<listener>
<listener-class>
com.icesoft.faces.util.event.servlet.ContextEventRepeater
</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Persistent Faces Servlet -->
<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Blocking Servlet -->
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet
</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<!-- Persistent Faces Servlet Mappings -->
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>
<!-- Blocking Servlet Mapping -->
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
-----------------------
liferay-portlet.xml
-----------------------
<portlet>
<portlet-name>SOmePortletName</portlet-name>
<instanceable>false</instanceable>
<render-weight>1</render-weight>
<ajaxable>true</ajaxable> <!-- also tried with the value false>
</portlet>
-----------------
home.xhtml
-----------------
<ice:outputText value="#{HomeController.status}"
style="line-height:2em"/>
-----------------
HomeController class
-----------------
public class HomeController implements Renderable {
private OnDemandRenderer stockGroup;
private String groupName;
/*************************************************/
/****************** Status ***********************/
private Timestamp status;
public Timestamp getStatus() {
return status;
}
public void setStatus(Timestamp astatus) {
this.status = astatus;
}
/*************************************************/
/****************** State ***********************/
private PersistentFacesState state;
public PersistentFacesState getState(){
return state;
}
/*************************************************/
/*************** RenderManager ******************/
private RenderManager renderManager;
public void setRenderManager( RenderManager renderManager ){
this.renderManager = renderManager;
}
public HomeController(){
state = PersistentFacesState.getInstance();
}
public void Update(ActionEvent event){
this.groupName = "SetGroupNameForEachGroup";
stockGroup = renderManager.getOnDemandRenderer( groupName );
stockGroup.add(this);
}
public void UpdateStatus(ActionEvent event){
try{
this.setStatus(now);
stockGroup.requestRender();
}catch(Exception e){
System.out.println("Exception "+e);
}
}
public void dispose() throws Exception {
stockGroup.remove(this);
}
public void renderingException(RenderingException renderingException){
//attempts to render this user.
stockGroup.remove(this);
}
}
-----------------------------
I am using icefaces 1.8.2 with liferay 5.2.3 on GLASSFISH 2.1 on windowsXP.
push server.war is install and in the log all i see is this message
20:35:30,105 INFO [RenderHub:238] core render service created:
core pool size : 10
max pool size : 15
keep alive time: 300000
|#]
Anyone ? or anyway from icefaces ?
thanks
Khan
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 09/08/2010 10:36:30
|
deryk.sinotte

Joined: 26/10/2004 00:00:00
Messages: 930
Online
|
Can you successfully build and deploy on of the portlet examples that come with the ICEfaces distributions? There are a couple under [icefaces.dir]/samples/portlets.
There is also an introductory Ajax Push tutorial online that you walk through. It's not specific to portlets but it might be helpful:
http://facestutorials.icefaces.org/tutorial/easy-ajax-push.html
One thing in your code is that that you're adding the Renderable bean in what looks like an Update actionListener. This means that the bean will not be added to the render group until that actionListener is triggered (ie clicking a button). If you want the bean added to the group when the bean is created, you should move that logic to the setter where the RenderManager is injected.
|
Deryk Sinotte
Team Lead
ICEsoft Technologies, Inc. |
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 09/08/2010 15:31:52
|
asif436
Joined: 19/12/2008 00:00:00
Messages: 17
Offline
|
hi deryk,
thanks 4 ur reply.
I did take a look @ the tutorial u mentioned and some of the other tutorials on ajax push... they all provide the same code mechanism. I 'm just wondering if icefaces 1.8.2 and liferay 5.2.3 work fine when using ajax push.... is there any setting or configuration that i maybe missing....
???
asif
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 13/08/2010 07:28:01
|
asif436
Joined: 19/12/2008 00:00:00
Messages: 17
Offline
|
Hi deryk,
So after further investigation I found out that this is what is generated by the icefaces push when i try to send the updates to client browser.
<updates>
<update address="_Monitor_WAR_Monitor001SNAPSHOT_INSTANCE_qF6v_:iceform:j_id14" tag="span">
<attribute name="class"><![CDATA[iceOutTxt]]></attribute><attribute name="id">
<![CDATA[_Monitor_WAR_Monitor001SNAPSHOT_INSTANCE_qF6v_:iceform:j_id14]]>
</attribute>
<attribute name="style"><![CDATA[line-height:2em]]></attribute><content><![CDATA[2010-06-17 01:18:03.998]]></content>
</update>
</updates>
<<<<<![CDATA[2010-06-17 01:18:03.998]] >>>>>> is the time stamp i want to send to client browser using ondemand renderer
However client browser does not get updated with the icefaces push
Hope that you would be able to provide me direction.
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 13/08/2010 10:26:17
|
deryk.sinotte

Joined: 26/10/2004 00:00:00
Messages: 930
Online
|
The update looks about right so perhaps it's not getting applied due to some other error. Are you using a browser that has a JavaScript console of some kind (ie Firefox + Firebug or Chrome) that would log a problem?
You can also try CTRL-SHIFT-T to bring up the ICEfaces client console and see if it logs anything.
Besides that, you could post a simple example of your portlet .war for us to look at.
|
Deryk Sinotte
Team Lead
ICEsoft Technologies, Inc. |
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 22/08/2010 02:12:43
|
binhdq
Joined: 25/08/2009 00:00:00
Messages: 11
Offline
|
Hello deryk,
I created 2 portlets based on Icefaces push technology. Each portlet is on a different WAR file.
If i deploy only one WAR file. The portlet works well. If i deploy 2 WARs file in Liferay the portlets will not work properly(ajax push not working) althrough i already deployed Push Server Comunity server.
To test my assumtion. I packed 2 portlets in only one WAR file and they work.
My server is Tomcat 6 and already deployed in NIO mode.
It seems that i have to deploy AHS to make 2 WAR files work
Could you tell me where i am wrong here?
Thanks you
| Filename |
IcefacesLocationPortlet.war |
Download
|
| Description |
Location |
| Filesize |
292 Kbytes
|
| Downloaded: |
33 time(s) |
| Filename |
ShoppingCartPortlet-portlet.war |
Download
|
| Description |
ShoppingCart |
| Filesize |
65 Kbytes
|
| Downloaded: |
23 time(s) |
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 25/08/2010 18:09:00
|
asif436
Joined: 19/12/2008 00:00:00
Messages: 17
Offline
|
Hi Deryk:
Sorry for replying you back so late. I had to build a simple sample war for you and in doing so I ran into another issue.
Anyway here is the output from the google chrome browser. I don't see any error in the server log file however I don't see
the updates in the second browser after clicking the update button.
Output is listed below with the screen shot and sample war file.
send-receive-updates:
<updates>
<update address="_Monitor_WAR_Monitor001SNAPSHOT_:iceform:lblTime" tag="label">
<attribute name="class">
<![CDATA[iceOutLbl portlet-form-label]]>
</attribute>
<attribute name="id">
<![CDATA[_Monitor_WAR_Monitor001SNAPSHOT_:iceform:lblTime]]>
</attribute>
<content>
<![CDATA[2010-06-29 11:10:42.856]]>
</content>
</update>
<update address="-Z9YnkTJ__NakpPcFKOfGQ:1:dynamic-code" tag="script">
<attribute name="id">
<![CDATA[-Z9YnkTJ__NakpPcFKOfGQ:1:dynamic-code]]>
</attribute>
<attribute name="type">
<![CDATA[text/javascript]]>
</attribute><content>
<![CDATA[Ice.Focus.setFocus('undefined');//1699947027]]>
</content>
</update>
</updates>
receive-updates-views:
<updated-views>-Z9YnkTJ__NakpPcFKOfGQ:1 </updated-views>
receive-updates:
<updates>
<update address="-Z9YnkTJ__NakpPcFKOfGQ:1:dynamic-code" tag="script"><attribute name="id"><![CDATA[-Z9YnkTJ__NakpPcFKOfGQ:1:dynamic-code]]></attribute><attribute name="type"><![CDATA[text/javascript]]></attribute><content/></update></updates>
ping:
<noop/>
My portlet crashes if I put the addbtn logic in the request bean constructor method that's why i had to put it in the btn event.
Server Output is given below when these two lines are added in the constructor
stockGroup = renderManager.getOnDemandRenderer( "DynamicGroupName" );
stockGroup.add(this);
Server Output
Caused by: javax.faces.FacesException: Cant instantiate class: com.test.controllerr.LocationController.. null
at com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryImpl.java:282)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:546)
... 219 more
Let me know if you require additional information
| Filename |
screenShot.bmp |
Download
|
| Description |
|
| Filesize |
3000 Kbytes
|
| Downloaded: |
14 time(s) |
| Filename |
Monitor-0.0.1-SNAPSHOT.war |
Download
|
| Description |
|
| Filesize |
8392 Kbytes
|
| Downloaded: |
21 time(s) |
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 26/08/2010 00:42:27
|
binhdq
Joined: 25/08/2009 00:00:00
Messages: 11
Offline
|
Hello,
Iam tring to deploy push server with Liferay 6 bundle with Jetty.
I got the following error:
2010-08-26 04:56:20.934:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2010-08-26 04:56:21.043:INFO::jetty-6.1.24
Aug 26, 2010 4:56:21 AM com.liferay.portal.kernel.log.Jdk14LogImpl info
INFO: Initializing hot deploy manager 12468716
04:56:22,400 INFO [PushServlet:86]
ICEsoft Technologies, Inc.
ICEfaces Push Server 1.8.2
Build number: 7
Revision: 19321
04:56:22,416 INFO [EnvironmentAdaptingServlet:44] Adapting to Jetty ARP environ
ment
04:56:22,478 ERROR [PushServlet:131] An error occurred while initializing the Pu
sh Server!
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(String.java:1937)
at com.icesoft.util.ServerUtility.getServletContextPath(ServerUtility.ja
va:136)
at com.icesoft.net.messaging.MessageServiceClient.setBaseMessageProperti
es(MessageServiceClient.java:1286)
at com.icesoft.net.messaging.MessageServiceClient.<init>(MessageServiceC
lient.java:112)
at com.icesoft.net.messaging.MessageServiceClient.<init>(MessageServiceC
lient.java:129)
at org.icefaces.push.server.PushServlet.init(PushServlet.java:95)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.jav
a:440)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:26
3)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.ja
va:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.jav
a:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467
)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection
.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHan
dlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection
.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mortbay.start.Main.invokeMain(Main.java:194)
at org.mortbay.start.Main.start(Main.java:534)
at org.mortbay.start.Main.start(Main.java:441)
at org.mortbay.start.Main.main(Main.java:119)
Aug 26, 2010 4:56:22 AM com.sun.faces.config.ConfigureListener contextInitialize
d
Anyone helps me out of this error?
|
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 27/08/2010 00:19:08
|
binhdq
Joined: 25/08/2009 00:00:00
Messages: 11
Offline
|
I followed the trace and looked at com.icesoft.util.ServerUtility.java
The code that causes the error is:
if (_serverInfo.startsWith("jetty")) {
136 _servletContextPath =
137 _path.substring(
138 _path.indexOf("__") + 2,
139 _path.lastIndexOf("__"));
140 }
Can anyone helps me out of this?
|
|
|
 |
|
|