Foren

lf 5.2.1 Cache Filter and Gzip Filter disables zk app

Kees Vegter, geändert vor 15 Jahren.

lf 5.2.1 Cache Filter and Gzip Filter disables zk app

New Member Beiträge: 11 Beitrittsdatum: 15.01.09 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 11 Beitrittsdatum: 15.01.09 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beitrag: 1 Beitrittsdatum: 09.02.09 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 11 Beitrittsdatum: 15.01.09 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 8 Beitrittsdatum: 16.03.09 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 11 Beitrittsdatum: 15.01.09 Neueste Beiträge
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
thumbnail
Deven Phillips, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 5 Beitrittsdatum: 09.04.09 Neueste Beiträge
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.
thumbnail
Deven Phillips, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 5 Beitrittsdatum: 09.04.09 Neueste Beiträge
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!!
fastbob fastbob, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

Regular Member Beiträge: 221 Beitrittsdatum: 16.05.05 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 11 Beitrittsdatum: 15.01.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 3 Beitrittsdatum: 25.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 3 Beitrittsdatum: 25.06.09 Neueste Beiträge
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, geändert vor 14 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 14 Beitrittsdatum: 12.03.10 Neueste Beiträge
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, geändert vor 11 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

New Member Beiträge: 6 Beitrittsdatum: 18.09.12 Neueste Beiträge
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
thumbnail
Vishal Panchal, geändert vor 11 Jahren.

RE: liferay 5.2.1 + tomcat + ZK broken?

Expert Beiträge: 289 Beitrittsdatum: 20.05.12 Neueste Beiträge
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