Pluto"

From Documentation
(Created page with '{{ZKInstallationGuidePageHeader}} = Deploy a ZK Porlet = ==web.xml== Define the definition of porlet in web.xml <syntax lang="xml"> <web-app> <display-name>ZK Portlets</dis…')
 
m
Line 7: Line 7:
 
Define the definition of porlet in web.xml
 
Define the definition of porlet in web.xml
  
<syntax lang="xml">
+
<source lang="xml">
 
<web-app>  
 
<web-app>  
 
<display-name>ZK Portlets</display-name>  
 
<display-name>ZK Portlets</display-name>  
Line 71: Line 71:
 
</security-role>  
 
</security-role>  
 
</web-app>  
 
</web-app>  
</syntax>
+
</source>
  
 
==portlet.xml==
 
==portlet.xml==
Line 77: Line 77:
 
Define a ZK portlet in portlet.xml.
 
Define a ZK portlet in portlet.xml.
  
<syntax lang="xml">
+
<source lang="xml">
 
<portlet-app  
 
<portlet-app  
 
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"  
 
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"  
Line 116: Line 116:
 
  </portlet>   
 
  </portlet>   
 
</portlet-app>  
 
</portlet-app>  
</syntax>
+
</source>
  
 
= How to resolve Session Timeout =
 
= How to resolve Session Timeout =
Line 122: Line 122:
 
The cause of this problem is that ZK cannot find the desktop from its session. Why? ZK desktop was stored in the session of pluto instead of ZK webapp because pluto pass its session to ZK webapp while doing cross-context in Tomcat. This breaks the spec of servlet. So far, there is no good solution. But here is a workaround that ZK stores desktop in application scope instead of session scope to avoid the problem. Please add the following lines in your zk.xml </p>
 
The cause of this problem is that ZK cannot find the desktop from its session. Why? ZK desktop was stored in the session of pluto instead of ZK webapp because pluto pass its session to ZK webapp while doing cross-context in Tomcat. This breaks the spec of servlet. So far, there is no good solution. But here is a workaround that ZK stores desktop in application scope instead of session scope to avoid the problem. Please add the following lines in your zk.xml </p>
  
<syntax source="xml">
+
<source source="xml">
 
<system-config>  
 
<system-config>  
 
<cache-provider-class>org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider</cache-provider-class>  
 
<cache-provider-class>org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider</cache-provider-class>  
 
</system-config>  
 
</system-config>  
</syntax>
+
</source>
  
 
=Version History=
 
=Version History=

Revision as of 03:38, 22 September 2010


Deploy a ZK Porlet

web.xml

Define the definition of porlet in web.xml

<web-app> 
	<display-name>ZK Portlets</display-name> 
 
	<servlet> 
		<description>ZK loader for ZUML pages</description> 
		<servlet-name>zkLoader</servlet-name> 
		<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class> 
		<init-param> 
			<param-name>update-uri</param-name> 
			<param-value>/zkau</param-value> 
		</init-param> 
		<load-on-startup>1</load-on-startup><!-- Must --> 
	</servlet> 
 
	<servlet-mapping> 
		<servlet-name>zkLoader</servlet-name> 
		<url-pattern>*.zul</url-pattern> 
	</servlet-mapping>  
	<servlet-mapping> 
		<servlet-name>zkLoader</servlet-name> 
		<url-pattern>/zk/*</url-pattern> 
	</servlet-mapping> 
 
	<servlet> 
		<description>The asynchronous update engine for ZK</description> 
		<servlet-name>auEngine</servlet-name> 
		<servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class> 
	</servlet> 
	<servlet-mapping> 
		<servlet-name>auEngine</servlet-name> 
		<url-pattern>/zkau/*</url-pattern> 
	</servlet-mapping> 

	<servlet> 
		<servlet-name>zkportlet</servlet-name> 
		<servlet-class>org.apache.pluto.core.PortletServlet</servlet-class> 
		<init-param> 
			<param-name>portlet-name</param-name> 
			<param-value>zkportlet</param-value> 
		</init-param> 
		<load-on-startup>1</load-on-startup> 
	</servlet>
 
	<servlet-mapping> 
		<servlet-name>zkportlet</servlet-name> 
		<url-pattern>/PlutoInvoker/zkportlet</url-pattern> 
	</servlet-mapping>
 
	<session-config> 
		<session-timeout>120</session-timeout> 
	</session-config> 
 
	<welcome-file-list> 
		<welcome-file>index.zul</welcome-file> 
		<welcome-file>index.zhtml</welcome-file> 
		<welcome-file>index.html</welcome-file> 
		<welcome-file>index.htm</welcome-file> 
	</welcome-file-list> 

	<security-role> 
		<role-name>tomcat</role-name> 
	</security-role> 
</web-app>

portlet.xml

Define a ZK portlet in portlet.xml.

<portlet-app 
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" 
version="1.0" 
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>ZKloader for ZUML pages</description> 
		<portlet-name>zkportlet</portlet-name> 
		<display-name>ZK Portlet Loader</display-name> 
		<portlet-class>org.zkoss.zk.ui.http.DHtmlLayoutPortlet</portlet-class> 
		<init-param> 
			<name>zk_page</name> 
			<value>/index.zul</value> 
		</init-param> 
 		<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>ZK</title> 
			<short-title>ZK</short-title> 
			<keywords>ZK,ZUML</keywords> 
		</portlet-info> 
 
		<security-role-ref> 
			<role-name>plutoTestRole</role-name> 
			<role-link>tomcat</role-link> 
		</security-role-ref> 
 	</portlet>  
</portlet-app>

How to resolve Session Timeout

The cause of this problem is that ZK cannot find the desktop from its session. Why? ZK desktop was stored in the session of pluto instead of ZK webapp because pluto pass its session to ZK webapp while doing cross-context in Tomcat. This breaks the spec of servlet. So far, there is no good solution. But here is a workaround that ZK stores desktop in application scope instead of session scope to avoid the problem. Please add the following lines in your zk.xml

<system-config> 
	<cache-provider-class>org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider</cache-provider-class> 
</system-config>

Version History

Version Date Content
     



Last Update : 2010/09/22

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.