Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kees Vegter
lf 5.2.1 Cache Filter and Gzip Filter disables zk app
February 6, 2009 4:44 AM
Answer

Kees Vegter

Rank: New Member

Posts: 11

Join Date: January 14, 2009

Recent Posts

Hi,
I am testing my zk portlets on liferay 5.2.1 with tomcat 6 (also the same problem with tomcat 5.5). The zk portlet is added via the hot deployer in a portlet war.
The problem is that the ZK window is halted. Looking at the http communication I see that urls ending on *.js are 'halted'. The result is that the ZK window will stay in the 'loading' state. urls like this are blocked: ../zkau/web/_zv08120909/_zcbzk.ald-6/js/zul/pg.js
it looks like that every url with *.js to the portlet war is blocked.
This behavior is the same on tomcat 5.5 and tomcat 6.0.18.
I tested also the zk page directly, bypassing the portal, and the same error occurs when the portlet is loaded by the hot deployer.
However when I copy the portlet war directly to the tomcat webapps directory and cleaning all session/cache data in the browser then the zk application works.
With liferay 5.1.2 it worked fine.
Please help. Is there some (new) setting i have to change?
Kees Vegter
RE: liferay 5.2.1 + tomcat + ZK broken?
February 6, 2009 3:17 AM
Answer

Kees Vegter

Rank: New Member

Posts: 11

Join Date: January 14, 2009

Recent Posts

I Found the cause.
In liferay 5.2.1 the liferay deployer add liferay cache filters to the web.xml of the portlet war.
The following filter mappings in the web.xml are causing the ZK 'block'.
<filter-mapping> <filter-name>Cache Filter - Resource</filter-name> <url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping> <filter-name>GZip Filter</filter-name> <url-pattern>*.js</url-pattern>
</filter-mapping>
When you remove these two mappings from the web.xml of the portlet war the ZK application works.
Is there a way to configure the portal-ext.properties in such a way that the deployer of liferay is not adding these filter mappings to the portlet war web.xml?
tia
kvegter
Mathias Wiesbauer
RE: liferay 5.2.1 + tomcat + ZK broken?
February 9, 2009 7:56 AM
Answer

Mathias Wiesbauer

Rank: New Member

Posts: 1

Join Date: February 9, 2009

Recent Posts

Hi, i have the exact same problem, but your fix didn't work for me.

I am absolutely new to ZK and Liferay, how do you actually deploy your *.ZUL file??
Is there a *.WAR file that i should use? currently I am deploying the demo war and I copy my *.ZUL file into the directory and change the index file.

I can see the portlet but it remains in loading state, even after I apply your fix?

Thank you
Mathias
Kees Vegter
RE: liferay 5.2.1 + tomcat + ZK broken?
February 10, 2009 11:59 PM
Answer

Kees Vegter

Rank: New Member

Posts: 11

Join Date: January 14, 2009

Recent Posts

Mathias,
I work with the hot deployment loader of liferay e.g. DEPLOY_TO__mywar.war.
In the 5.2 version there is a deploy directory within the liferay bundle (I use tomcat).
I remove the filter mappings as described earlier from my DEPLOYED web.xml. Because the hot deployer of liferay adds these filter structures to my 'war' web.xml.


Below a description of how i work with zk pages in liferay
In that war I add the liferay xml files and a portlet.xml in the WEB-INF directory
I use the ZK portlet to run zul pages.
Listing WEB-INF
liferay-display.xml
liferat-plugin-package.xml
liferay-portlet.xml
portlet.xml
web.xml
zk.xml
portlet.xml snippet
<portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>Phonelist</title>
<short-title>Phonelist</short-title>
<keywords>Phonelist</keywords>
</portlet-info>
<portlet-preferences> <preference> <name>zk_page</name> <value>/phonelist/index.zul</value> </preference>
In the xml above you see the portlet-class is just the standard zk portlet.
With the preference zk_page you make a reference to your zul page.
tips;
I use a filter in the war that deployed on the liferay server the zul page can only be called from within the portlet (checking if the request is a portletrequest or not)
In development however I test and create the zk page directly without the portlet structure. Make sure that the portlet.jar (portet api) is added to your tomcat lib.
This works for me very well.
Hope this helps
gr Kees
Mario Arrigoni Neri
RE: liferay 5.2.1 + tomcat + ZK broken?
March 16, 2009 9:41 AM
Answer

Mario Arrigoni Neri

Rank: New Member

Posts: 7

Join Date: March 16, 2009

Recent Posts

Hello.
I'm very confused.
I cannot deploy a working ZK portlet in liferay 5.2.1.
Can anyone send me a trivial working example?
What about edi and help pages?

thanks
Kees Vegter
RE: liferay 5.2.1 + tomcat + ZK broken?
March 19, 2009 3:03 AM
Answer

Kees Vegter

Rank: New Member

Posts: 11

Join Date: January 14, 2009

Recent Posts

Mario,

I don't know what your configuration is, but in addition to the posts above the following:

* Eclipse and zk studio plugin
I use eclipse europa with the zk studio plugin.
- You can download the plugin from the zk site. You also have to download the zk bundle for instance the 3.6.0.zip.
follow the installation instructions from the zk site

* Eclipse and tomcat
* I use tomcat 6 , and installed in on my local computer
* in the tomcat_home/lib directory I added the portlet.jar
(this is the "api 1.0" jar you can download it from the jsr-168 site: http://jcp.org/aboutJava/communityprocess/final/jsr168/index.html)
When you make portlets in you web projects this will compile.
* Make a server definition in tomcat for your local tomcat server

* Making a zk project
* In eclipse do file-new-project and choose "dynamic web project" wizard and name it 'TestProject'
* In the wizard select the "ZK supports" facet and on one of the next pages the zk library version
Now you have a valid zk web project!
* Create with file-new a new zk page, for instance index.zul
* test now this page via "Run As - Run On Server"

* Make the zk page run in an liferay portal
I use the org.zkoss.zk.ui.http.DHtmlLayoutPortlet (from zk) to run the zk page. In order to make it work on liferay follow the following steps:
- create a portlet.xml in the WEB-INF directory

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app version="1.0" xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
<portlet>
<description xml:lang="EN">MyTest</description>
<portlet-name>MyTest</portlet-name>
<display-name xml:lang="EN">MyTest</display-name>
<portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>MyTest Portlet</title>
<short-title>MyTest</short-title>
<keywords>test</keywords>
</portlet-info>
<portlet-preferences>
<preference>
<name>zk_page</name>
<value>/index.zul</value>
</preference>
</portlet-preferences>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
</portlet>
</portlet-app>

* create now a liferay-portlet.xml in the WEB-INF directory

<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>MyTest</portlet-name>
</portlet>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
</liferay-portlet-app>

* create now liferay-display.xml in the WEB-INF directory

<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD DISPLAY 2.0.0//EN" "http://www.liferay.com/dtd/liferay-display_2_0_0.dtd">

<display>
<category name="Test portlets">
<portlet id="MyTest" />
</category>
</display>

* create now liferay-plugin-package.xml in WEB-INF directory:

<?xml version="1.0"?>
<!DOCTYPE plugin-package PUBLIC "-//Liferay//DTD Plugin Package 4.3.6//EN" "http://www.liferay.com/dtd/liferay-plugin-package_4_3_0.dtd">
<plugin-package>
<name>Test portlets</name>
<module-id>com/demo/test/testportlets/war</module-id>
<types>
<type>portlet</type>
</types>
<short-description>
Test Portlets
</short-description>
<change-log>
Adapted to the latest version of Liferay.
</change-log>

<author>My Name</author>
<licenses>
<license osi-approved="true">MIT</license>
</licenses>i
<liferay-versions>
<liferay-version>5.1.1+</liferay-version>
<liferay-version>5.2.1+</liferay-version>
</liferay-versions>
</plugin-package>

* Now the web project is ready to deploy on the liferay portal
I use the hot deployer of liferay:
- First right click on the project node, and choose export war file
- make sure that you are following the naming convention "DEPLOY_TO__<my project>.war"
in this example DEPLOY_TO__TestProject.war, and export it to a directory
- In my environment i have liferay running on linux (and tomcat). So have to copy the war file to the 'deploy' directory which is available in the liferay-tomcat bundle. If you are running on windows than you can export the war from eclipse directly into this directory.
- follow the tomcat log (catalina.out) and you will see that your portlet is registered.
- go into the webapps/TestProject/WEB-INF directory and open the web.xml
- remove or 'comment out' the filter-mappings as described above and save the web.xml


* Place the new portlet on a liferay page
- make a page
- via add application you will see an entry "Test portlets" where you can choose the new portlet.

I hope this helps...

gr Kees
Deven Phillips
RE: liferay 5.2.1 + tomcat + ZK broken?
April 9, 2009 12:29 PM
Answer

Deven Phillips

Rank: New Member

Posts: 5

Join Date: April 9, 2009

Recent Posts

OK, after much trial and error the suggestion above works, but there MUST be a better way. Can't there be a configuration option in portlet.xml or lilferay-portlet.xml which does all of this automatically? Having to go in and edit the web.xml for every portlet deployed is a horrible hindrance. Besides, for people interested in ZK programming, this is going to be a serious hassle.
Deven Phillips
RE: liferay 5.2.1 + tomcat + ZK broken?
April 9, 2009 12:51 PM
Answer

Deven Phillips

Rank: New Member

Posts: 5

Join Date: April 9, 2009

Recent Posts

Woohoo!!! I found it!!!

OK, to be completely up front, this will likely effect the performance of your Portal due to disabling caching for many things, but ZK will work without issue after this change.

Once you have installed Liferay, shut down the java server container it is running in. Go into the deployed Liferay application and in the "ROOT" (tomcat terms), modify the WEB-INF/classes/portal-ext.properties file and add the following 2 lines:

com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.gzip.GZipFilter=false

Start the application server back up and Liferay will never add the cache filters to the web.xml ever again. Now, on to my next problem: ZK id collisions in Liferay!!
Bob Dietrich
RE: liferay 5.2.1 + tomcat + ZK broken?
April 11, 2009 12:42 PM
Answer

Bob Dietrich

Rank: Regular Member

Posts: 221

Join Date: May 15, 2005

Recent Posts

I don't know if it will work for your situation, but there is a fairly new portlet setting "speed-filters-enabled=false" that might help. See RE: sample-icefaces-ipc-ajax-push-portlet broken i and RE: How well Icefaces and jQuery work togehter in liferay? for more info.
Kees Vegter
RE: liferay 5.2.1 + tomcat + ZK broken?
April 22, 2009 1:25 AM
Answer

Kees Vegter

Rank: New Member

Posts: 11

Join Date: January 14, 2009

Recent Posts

Thanks a lot this property does it.
adding the property "speed-filters-enabled=false" in the liferay-plugin-package.properties file in the WEB-INF directory solves the problem

Thanks!
Marcello De Marco
RE: liferay 5.2.1 + tomcat + ZK broken?
June 25, 2009 2:41 AM
Answer

Marcello De Marco

Rank: New Member

Posts: 3

Join Date: June 25, 2009

Recent Posts

Hi all,
I have some problems if i change the liferay root context.
If i work with liferay on the default root context my zkoss portlet works fine.
If i rename the liferay root war as mportal and i add the file:
mportal/WEB-INF/classes/portal-ext.properties
with the property:
portal.ctx=/mportal

then the portal works normally on the context mportal, but the zkoss portlet always tell me the message:
"The resource you request is no longer available...." like if the session expires.

I tried to apply the suggestions in the previous posts and to increase the zkoss session-timeout but never changed.

Thanks in advance.
Marcello De Marco
RE: liferay 5.2.1 + tomcat + ZK broken?
June 29, 2009 6:39 AM
Answer

Marcello De Marco

Rank: New Member

Posts: 3

Join Date: June 25, 2009

Recent Posts

I found a workaround.
The same in http://jira.icefaces.org/browse/ICE-2104.
Trying setting emptySessionPath in server.xml:

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"
emptySessionPath="true" />

Thanks
M.
Andrey Siver
RE: liferay 5.2.1 + tomcat + ZK broken?
March 22, 2010 12:31 AM
Answer

Andrey Siver

Rank: New Member

Posts: 14

Join Date: March 12, 2010

Recent Posts

I met the same problem with Liferay 5.2.3 ("...the ZK portlet screen is not accessible, only snipping "loading" above").

And:
1) the adding the property "speed-filters-enabled=false" in the liferay-plugin-package.properties file in the WEB-INF directory of the portlet does not help me.
2) the adding the properties:
com.liferay.portal.servlet.filters.cache.CacheFilter=false
com.liferay.portal.servlet.filters.gzip.GZipFilter=false
in the portal-ext.properties file in the ROOT/WEB-INF/classes directory of the portal does not help also.

Are there any suggestions?

Thanks.
imran khan
RE: liferay 5.2.1 + tomcat + ZK broken?
September 25, 2012 7:31 AM
Answer

imran khan

Rank: New Member

Posts: 6

Join Date: September 17, 2012

Recent Posts

HI ,
I am trying to create a dynamic web project with ZKoss and Liferay , But can not able to call Composer class .

Can u plz send me any sample project with ZK composer and ZUL .

Thanks in advance
Vishal Panchal
RE: liferay 5.2.1 + tomcat + ZK broken?
September 25, 2012 11:59 AM
Answer

Vishal Panchal

Rank: Expert

Posts: 279

Join Date: May 20, 2012

Recent Posts

imran khan:
HI ,
I am trying to create a dynamic web project with ZKoss and Liferay , But can not able to call Composer class .

Can u plz send me any sample project with ZK composer and ZUL .

Thanks in advance


Hi imran khan,


kindly visite this link for sample project with ZK composer and ZUL.

And yes for doing this in liferay all you have to do is to follow below steps,
1) create one .zul file and add following content in it.
<div apply="demo.window.modal_dialog.ModalDialogController">
<button id="orderBtn" label="Order Coffee" autodisable="self" />
</div>

2) Create one package named "demo.window.modal_dialog"
3) in the above package create one class named ModalDialogController which extends GenericForwardComposer

now you can handle any events from zul file in your ModalDialogController .
Thats it.!

Thanks & Regards,
Vishal R. Panchal