Can I use ICEPush in portlet applications?

Hi All,

I was trying to use this ICEPush in my portlet application and getting the below error:

13:48:44,734 ERROR [jsp:154]
java.lang.RuntimeException: Only servlet deployment
is supported

What is the solution to get this working in portlet applications?

thanks,
Trivedi

You might want to try your question on the ICEpush forums:


ICEpush Forums

When you post there, perhaps you can provide more information about your project.

What portal are you trying to integrate with?
What version of ICEpush?
How are you trying to integrate ICEpush into your application?
Are you also using ICEfaces or are you trying to integrate ICEpush with Vaadin?

I am trying with Liferay

I am using ICEPush Vaadin add-on [http://vaadin.com/directory#addon/icepush]

As per the instructions given in ICEPush Vaadin add-on

I am trying to integrate ICEPush add-on into my Vaadin portlet application.

Thanks,
Trivedi

Did you ever find a response to this query? I have asked on the ICEPush forum as well with no response. Given the need to use the ICEPush servlet I’m assuming you cannot use it in a portlet, but I’m hoping that is wrong.

Hi,

I found some spare time and made some change to ICEPush and maybe got it to work in Liferay. I have not released a new version in the Directory yet as I am not really sure it works.

I also moved the project to Git hub but if you are interested to test if it works for you, try out
http://github.com/R2R/ICEPush-for-Vaadin/raw/master/build/icepush-0.1.5.jar
(remember to rebuild the widgetset to include the ICEPush add-on, e.g. using Vaadin Control Panel for Liferay. You also need icepush.jar and icepush-gwt.jar from add-on 0.1.2 zip)

Create a portlet2 application as normal and additionally add a web.xml to your project where you simply map all requests to the ICEPushServlet, e.g:

<servlet>
		<servlet-name>ICEPush for Portlets</servlet-name>
		<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>ICEPush for Portlets</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>

There might be some session related issues as this relies on the session being shared between the portlet and the servlet.

The github link doesn’t seem to be working

Yeah, sorry about that. There were some issues with the 0.1.5 and with the version I released in the Directory a couple of days back so I decided to pack everything together and put it in the Directory as 0.2.0. So you can get it from there now.

This should work:
http://github.com/R2R/ICEPush-for-Vaadin/raw/master/build/icepush-0.2.0.jar

I see what you did there, clever :smiley:

Artur,

Can you kindly post a small example/tips on how to use this in the portlet environment? My Vaadin application id defined in the portlet.xml as a init param to com.vaadin.terminal.gwt.server.ApplicationPortlet2, there is no servlet configuration [as indicated in the component download page]
in my web.xml, so I am not clear on how exactly to use the icepush component …

Thanks,
Imran

I try to run the ICEPush 0.2.0 with Liferay 6.0.5 (StandardEdition), but I get the [quote]
Widgetset does not contain implementation for org.vaadin.artur.icepush.ICEPush. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. …
[/quote]
I use Eclipse-Plugin, so that the application is re-compiled (after I added the jars).

Is it correct that ICEPush 0.2.0 has 3 jars (icepush.jar, icepush-0.2.0.jar and icepush-gwt.jar) ?

And this is my web.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>NotePortlet</display-name>
  <context-param>
  	<description>
  	Vaadin production mode</description>
  	<param-name>productionMode</param-name>
  	<param-value>false</param-value>
  </context-param>
  <servlet>
  	<servlet-name>Noteportlet Application</servlet-name>
  	<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
  	
  	<init-param>
  		<description>
  		Vaadin application class to start</description>
  		<param-name>application</param-name>
  		<param-value>de.tu_bs.tugether.noteportlet.NoteportletApplication</param-value>
  	</init-param>
  	<init-param>
  		<description>
  		Application widgetset</description>
  		<param-name>widgetset</param-name>
  		<param-value>de.tu_bs.tugether.noteportlet.widgetset.NoteportletWidgetset</param-value>
  	</init-param>
  	<load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
  	<servlet-name>Noteportlet Application</servlet-name>
  	<url-pattern>/NoteportletApplicationServlet/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  	<servlet-name>Noteportlet Application</servlet-name>
  	<url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

I use the Eclipse export-function to publish the portlet.

any ideas?

You will have to copy the new generated widgetset into liferay @ liferay-portal-6.0.5\tomcat-6.0.26\webapps\ROOT\html\VAADIN\widgetsets and have the correct entry in portal-ext.properties file for “vaadin.widgetset=de.tu_bs.tugether.noteportlet.widgetset.NoteportletWidgetset”. This should resolve the issue.

thanks for you solution. I have copied the widgetsets to …/ROOT/html/… and insert


<portlet>
        <portlet-name>Noteportlet Application portlet</portlet-name>
        <display-name>NotePortlet</display-name>
        
        <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet2</portlet-class>

        <init-param>
            <name>widgetset</name>
            <value>de.tu_bs.tugether.noteportlet.widgetset.NoteportletWidgetset</value>
         </init-param>
...

in portlet.xml. And the error is away.

But the requested Push-Effect is missing. I have now try with the basic sample application of ICEPush (with Button and Thread-sleep).

Any ideas?

Hi Artur,

I tried using this ICEPush with Portlet Application, during testing it was giving me null pointer exception at getPushContext(app.getContext()).push(ICEPush.PUSH_GROUP);

getPushContext(app.getContext())) is always returning NULL, any idea what could be the wrong?

Thanks,
Trivedi

The portlet support is based on a separate servlet, deployed using web.xml. If your normal portlet is working fine (and is using ApplicationPortlet2) you are off to a good start. What you need to do is add a web.xml where you map the servlet as described on the add-on page:

To use in a portlet you can use the same servlet to provide push capabilities. You need to add a web.xml that contians the following (headers, footers omitted):

 <servlet>
        <servlet-name>ICEPush for Portlets</servlet-name>
        <servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>ICEPush for Portlets</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

The web.xml should additionally contain the standard headers and footers.

The ICEPushServlet will then be loaded on startup and, provided they use the same classloader which they should be able to do as they are in the same war file, will set the URL that will be used for pushing. Adding the ICEPush component to the portlet should then automatically load the required files from the servlet and finally when calling push() correctly notify the servlet of the change, which in turns notifies the client (browser), which then asks the portlet for the changes.

Do you have the ICEPushServlet deployed as described in the add-on description? (And have included load-on-startup for the servlet?)

Hey, it works!!!

I have wrap your basic example with button as portlet for liferay, and it work!

ps: I can commit this portlet example, if needed.

Thanks,
Mark

Hi Mark Stein,

Could you pls share your example?

Thanks,
Trivedi

Hi Trivedi,

that must you do to take the portlet running:

change web.xml:


...
<servlet>
  	<servlet-name>Icepushdemo Application</servlet-name>
  	<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>
  	<load-on-startup>1</load-on-startup>
...

very important 1, else you get NullPointerException

and extend mapping also in web.xml:


...
<servlet-mapping>
  <servlet-name>Icepushdemo Application</servlet-name>
  <url-pattern>/*</url-pattern>
</servlet-mapping>
...

put 3 jar-files in WEB-INF/lib (icepush.jar, icepush-gwt.jar, icepush-0.2.0.jar)

copy widgetsets from ‘…\WebContent\VAADIN\widgetsets’
to
‘\tomcat-6.0.26\webapps\ROOT\html\VAADIN\widgetsets’

!!! not to the Portlet, but to the ROOT !!!

activate in portlet.xml widgetset-parameter and change it to your widgetset:


  <portlet>
   ...
        <init-param>
            <name>widgetset</name>
            <value>org.vaadin.markstein.icepush.widgetset.IcepushdemoWidgetset</value>
        </init-param>
  ...
  1. deploy :slight_smile:
    11494.zip (1.99 MB)

Hi all
i try to use icepush in vaadin portlet , i have 2 portlet ,1 portlet send data,and another receiver data , i want receiver portelt auto refresh view when it has receive change data from send portlet. i use event portlet to tranfer data (JSR 286)
it sucess send data and compile sucess but when i cal push() in portlet receiver nothing change
please show me why ,I post code here
thanks
11773.zip (1.25 MB)