zk.xml"

From Documentation
 
(23 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<tt>WEB-INF/zk.xml</tt> is the configuration descriptor of ZK. This file optional. If you need to configure ZK differently from the default, you could provide a file called <tt>zk.xml</tt> under the <tt>WEB-INF</tt> directory.
+
{{ZKConfigurationReferencePageHeader}}
  
The root element must be <tt><zk></tt>. Then, you could specify any combination of the following element under the root element.
+
__TOC__
  
== File Location ==
+
<code>WEB-INF/zk.xml</code> is the configuration descriptor of ZK. This file is optional. If you want to configure ZK differently from the default, you need to provide a file called <code>zk.xml</code> under the <code>WEB-INF</code> directory.
 +
 
 +
The root element must be <code><zk></code>. Then, you could specify any combination of the following elements under the root element.
 +
 
 +
= File Location =
  
 
You can place zk.xml in either a WAR file or a JAR file.
 
You can place zk.xml in either a WAR file or a JAR file.
  
=== WEB-INF/zk.xml ===
+
{{DoctypeDisallowed}}
 +
 
 +
== WEB-INF/zk.xml ==
 +
 
 +
<code>zk.xml</code> is usually packed with a Web application and it should be located under <code>WEB-INF</code>.
 +
 
 +
== metainfo/zk/zk.xml ==
 +
{{versionSince|3.6.0}}
 +
 
 +
For library providers, <code>zk.xml</code> is better to pack with a JAR file. This can be done by placing zk.xml in the <code>metainfo/zk</code> directory identifiable by the classpath (i.e., in a JAR file).
 +
 
 +
== Additional Configuration File ==
 +
{{versionSince| 5.0.7}}
 +
 
 +
In addition, you could specify an additional configuration file in a library or system property called <code>org.zkoss.zk.config.path</code>. It is useful if some of the configuration can not be part of the WAR file (such as depending on the deployment environment). For more information, please refer to [[ZK Configuration Reference/zk.xml/The Library Properties/org.zkoss.zk.config.path|this section]].
 +
 
 +
Notice that <code>zk.xml</code> found in the classpath is parsed first, then <code>WEB-INF/zk.xml</code>, and finally the additional configuration file. It means the additional configuration file, if any, has the highest priority, and <code>WEB-INF/zk.xml</code> (since the later will overrides the previous one if conflicts).
 +
 
 +
= XML Schema Definition =
 +
{{versionSince | 8.6.1}}
 +
 
 +
You could specify the XML schema in the zk.xml as shown below. Many XML editors works better, such as when with auto-complete, if XML schema is specified correctly.
  
<code>zk.xml</code> is usually packed with a Web application and it shall be located under <code>WEB-INF</code>.
+
<source lang="xml">
 +
<zk xmlns="http://www.zkoss.org/2005/zk/config"
 +
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 +
xsi:schemaLocation="http://www.zkoss.org/2005/zk/config http://www.zkoss.org/2005/zk/config/zk.xsd">
 +
</source>
  
=== metainfo/zk/zk.xml ===
+
The ZK schema can be downloaded from [http://www.zkoss.org/2005/zk/config/zk.xsd http://www.zkoss.org/2005/zk/config/zk.xsd]. In addition, you can find <code>zk.xsd</code> under the <code>dist/xsd</code> directory in the [https://www.zkoss.org/wiki/ZK_Installation_Guide/ZK_Background/The_Content_of_ZK_Binary_Distribution ZK binary distribution].
[since 3.6.0]
 
  
For library providers, <code>zk.xml</code> is better to be packed with a JAR file. It can be done by placing zk.xml in the <code>metainfo/zk</code> directory identifiable by classpath (i.e., in a JAR file).
+
{{ZKConfigurationReferenceHeadingToc}}
  
Notice that <code>zk.xml</code> found in the classpath is parsed first. It means <code>WEB-INF/zk.xml</code> has higher priority.
 
  
==List of Elements==
+
{{ZKConfigurationReferencePageFooter}}
*[[developer reference Appendix B. WEB-INF/zk.xml The richlet and richlet-mapping Elements | The richlet and richlet-mapping Elements]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The listener Element | The listener Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The log Element | The log Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The client-config Element | The client-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The desktop-config Element | The desktop-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The xel-config Element | The xel-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The language-config Element | The language-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The session-config Element | The session-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The system-config Element | The system-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The zscript-config Element | The zscript-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The device-config Element | The device-config Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The error-page Element | The error-page Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The preference Element | The preference Element]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The library-property Element | The library-property Element]]
 
**[[developer reference Appendix B. WEB-INF/zk.xml Library Properties | Library Properties]]
 
*[[developer reference Appendix B. WEB-INF/zk.xml The system-property Element | The system-property Element]]
 
[[Category:Developer's Reference]]
 

Latest revision as of 04:02, 19 January 2024


WEB-INF/zk.xml is the configuration descriptor of ZK. This file is optional. If you want to configure ZK differently from the default, you need to provide a file called zk.xml under the WEB-INF directory.

The root element must be <zk>. Then, you could specify any combination of the following elements under the root element.

File Location

You can place zk.xml in either a WAR file or a JAR file.

DOCTYPE restriction

Since 10.0.0

Starting from ZK 10, the xml parser used by ZK declares disallow-doctype-decl to true. This prevents the use of DOCTYPE declaration in xml files, such as zk.xml, lang-addon.xml, config. xml, etc. This is a security measure to prevent XXE attacks using <!DOCTYPE ...> as vector.

WEB-INF/zk.xml

zk.xml is usually packed with a Web application and it should be located under WEB-INF.

metainfo/zk/zk.xml

Since 3.6.0

For library providers, zk.xml is better to pack with a JAR file. This can be done by placing zk.xml in the metainfo/zk directory identifiable by the classpath (i.e., in a JAR file).

Additional Configuration File

Since 5.0.7

In addition, you could specify an additional configuration file in a library or system property called org.zkoss.zk.config.path. It is useful if some of the configuration can not be part of the WAR file (such as depending on the deployment environment). For more information, please refer to this section.

Notice that zk.xml found in the classpath is parsed first, then WEB-INF/zk.xml, and finally the additional configuration file. It means the additional configuration file, if any, has the highest priority, and WEB-INF/zk.xml (since the later will overrides the previous one if conflicts).

XML Schema Definition

Since 8.6.1

You could specify the XML schema in the zk.xml as shown below. Many XML editors works better, such as when with auto-complete, if XML schema is specified correctly.

<zk xmlns="http://www.zkoss.org/2005/zk/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zk/config http://www.zkoss.org/2005/zk/config/zk.xsd">

The ZK schema can be downloaded from http://www.zkoss.org/2005/zk/config/zk.xsd. In addition, you can find zk.xsd under the dist/xsd directory in the ZK binary distribution.


Subsections:




Last Update : 2024/01/19

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