org.zkoss.zk.config.path"

From Documentation
m (correct highlight (via JWB))
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
  
 
  Default: ''none''
 
  Default: ''none''
[since 5.0.7]
+
{{versionSince|5.0.7}}
  
It specifies another configuration file in addition to <code>WEB-INF/zk.xml</code>. This is useful if you have two or more environments, such as testing and production. Then, you could put the different configuration into separate files and load the required files based on the requirement.
+
It specifies another configuration file in addition to <code>WEB-INF/zk.xml</code>. This is useful if you have two or more environments, such as testing and production. Then, you could put the different configurations into separate files and load the required files based on the requirement.
  
The value could be one of the following:
+
The value can be one of the following:
  
* '''A servlet path''', such as <code>/WEB-INF/config/zk-extra.xml</code>
+
* '''A servlet path''': a path that [https://docs.oracle.com/javaee/7/api/javax/servlet/ServletContext.html#getResource-java.lang.String- ServletContext.getResourceAsStream()] can accept, such as:
* '''A file path''', such as <code>file:///home/http/zk.xml</code> and <code>file:///C:/test/zk.xml</code>, if you use Windows. Notice it must start with <code>file://</code><ref>For more information about the URI of a file, please refer to [http://en.wikipedia.org/wiki/File_URI_scheme File URI scheme].</ref>.
+
** a path under web context path
 +
** a path under <code>/WEB-INF/</code>, e.g. <code>/WEB-INF/config/zk-extra.xml</code>
 +
** relative to the <code>/META-INF/resources</code> directory of a JAR file inside the web application's /WEB-INF/lib directory
 +
* '''A file path''', such as <code>file:///home/http/zk.xml</code> and <code>file:///C:/test/zk.xml</code>, if you use Windows. Notice it must start with <code>file://</code> (For more information about the URI of a file, please refer to [http://en.wikipedia.org/wiki/File_URI_scheme File URI scheme].)
 
* '''A URL''', such as <code><nowiki>http://foo.com/config/zk.xml</nowiki></code>. Notice it must starts with <code>http://</code>, <code>https://</code>, and <code>ftp://</code>.
 
* '''A URL''', such as <code><nowiki>http://foo.com/config/zk.xml</nowiki></code>. Notice it must starts with <code>http://</code>, <code>https://</code>, and <code>ftp://</code>.
 +
*
  
 
Notice that <code>WEB-INF/zk.xml</code> is always loaded, and it is loaded before the configuration file specified in this system property. Thus, you could put the configurations common to each environment in <code>WEB-INF/zk.xml</code>, and put the difference to the extra configuration file.
 
Notice that <code>WEB-INF/zk.xml</code> is always loaded, and it is loaded before the configuration file specified in this system property. Thus, you could put the configurations common to each environment in <code>WEB-INF/zk.xml</code>, and put the difference to the extra configuration file.
Line 23: Line 27:
 
Another example is to provide an ID generator for the testing purpose. For more information, please refer to [[ZK Developer's Reference/Testing/Testing Tips#Different_Configuration_for_Different_Environment|ZK Developer's Reference: Testing Tips]].
 
Another example is to provide an ID generator for the testing purpose. For more information, please refer to [[ZK Developer's Reference/Testing/Testing Tips#Different_Configuration_for_Different_Environment|ZK Developer's Reference: Testing Tips]].
  
<blockquote>
+
 
----
 
<references/>
 
</blockquote>
 
  
 
=Version History=
 
=Version History=

Latest revision as of 06:10, 21 October 2022


org.zkoss.zk.config.path


Property:

org.zkoss.zk.config.path
Applicable:
Dndsmalltalk-check-icon.png globally in zk.xml via <library-property>
Dndsmalltalk-cross-icon.png not as <custom-attribute>
Default: none

Since 5.0.7

It specifies another configuration file in addition to WEB-INF/zk.xml. This is useful if you have two or more environments, such as testing and production. Then, you could put the different configurations into separate files and load the required files based on the requirement.

The value can be one of the following:

  • A servlet path: a path that ServletContext.getResourceAsStream() can accept, such as:
    • a path under web context path
    • a path under /WEB-INF/, e.g. /WEB-INF/config/zk-extra.xml
    • relative to the /META-INF/resources directory of a JAR file inside the web application's /WEB-INF/lib directory
  • A file path, such as file:///home/http/zk.xml and file:///C:/test/zk.xml, if you use Windows. Notice it must start with file:// (For more information about the URI of a file, please refer to File URI scheme.)
  • A URL, such as http://foo.com/config/zk.xml. Notice it must starts with http://, https://, and ftp://.

Notice that WEB-INF/zk.xml is always loaded, and it is loaded before the configuration file specified in this system property. Thus, you could put the configurations common to each environment in WEB-INF/zk.xml, and put the difference to the extra configuration file.

For example, assume you put the configuration in a file called /configs/zk-production.xml, then you could specify -Dorg.zkoss.zk.config.path=file:/configs/zk-production.xml as one of the arguments when starting the Web server.

Another example is to provide an ID generator for the testing purpose. For more information, please refer to ZK Developer's Reference: Testing Tips.


Version History

Last Update : 2022/10/21


Version Date Content
5.0.7 April, 2011 Introduced



Last Update : 2022/10/21

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