org.zkoss.web.util.resource.dir"

From Documentation
Line 25: Line 25:
  
  
== more details ==
+
= Overriding JAR's JavaScript Files=
  
For a normal scenario ,  maybe overwriting default Textbox behavior with allowkeys or change some behavior,  
+
Though rarely needed, you could override a JavaScript file of a JAR file with this option. For example, suppose you want to replace <code>zul/inp/Textbox.js</code> that is part of <code>zul.jar</code>, then you don't have to re-package <code>zul.jar</code>.  
in this case you just want to update Textbox js file in package zul.inp ,so you need not to overwrite all the files.
 
  
you just setup the config .
+
Rather, you could specify this library property as described above, and place the modified version of <code>Textbox.js</code> under the  <code>/WEB-INF/cwr/js/zul/inp</code> directory. Then, ZK will load <code>/WEB-INF/cwr/js/zul/inp/Textbox.js</code> you placed rather than the default one in <code>zul.jar</code>.
<source lang="xml">
 
<library-property>
 
<name>org.zkoss.web.util.resource.dir</name>
 
<value>/WEB-INF/cwr</value>
 
</library-property>
 
</source>
 
 
 
And then place the modified version of Textbox.js  in  /WEB-INF/cwr/js/zul/inp/Textbox.js .
 
 
 
You need not to overwrite the wpd  and the other files in zul.inp  , ZK will find the old files and work correctly.
 
 
 
As same as before, only if you want to change the wpd script list , you need to overwrite the wpd files.
 
  
 
  {{ZKConfigurationReferencePageFooter}}
 
  {{ZKConfigurationReferencePageFooter}}

Revision as of 01:47, 21 January 2011


org.zkoss.web.util.resource.dir


Property:

 org.zkoss.web.util.resource.dir
Default: none
[Since 5.0.0]

It specifies a directory, where ZK will load the so-called Class-Web Resources (CWR), in addition to the class path. CWR includes JavaScript files, CSS files, and other resources that are specified in the form of ~./xxx.

By default, ZK only searches the class path for the required CWR. By specifying a directory here, ZK will search the directory first and then the class path. It implies a developer can override the default behavior by providing a file with the same name.

Notice: don't put security sensitive files in the directory specified here, since they can be accessed externally.

For example, assume we have a JavaScript package called foo.great and we want to put it to WEB-INF/cwr. Then, we have to specify the following in WEB-INF/zk.xml:

	<library-property>
		<name>org.zkoss.web.util.resource.dir</name>
		<value>/WEB-INF/cwr</value>
	</library-property>

Then, you can place zk.wpd and required JavaScript files under the WEB-INF/cwr/js/foo/great directory.


Overriding JAR's JavaScript Files

Though rarely needed, you could override a JavaScript file of a JAR file with this option. For example, suppose you want to replace zul/inp/Textbox.js that is part of zul.jar, then you don't have to re-package zul.jar.

Rather, you could specify this library property as described above, and place the modified version of Textbox.js under the /WEB-INF/cwr/js/zul/inp directory. Then, ZK will load /WEB-INF/cwr/js/zul/inp/Textbox.js you placed rather than the default one in zul.jar.



Last Update : 2011/01/21

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