The richlet-mapping Element"

From Documentation
(Created page with '{{ZKConfigurationReferencePageHeader}} =Version History= {{LastUpdated}} {| border='1px' | width="100%" ! Version !! Date !! Content |- |   |   |   |} {{ZKConfig…')
 
Line 1: Line 1:
 
{{ZKConfigurationReferencePageHeader}}
 
{{ZKConfigurationReferencePageHeader}}
 +
 +
Once [[ZK Configuration Reference/zk.xml/The richlet Element|a richlet is declared]], you could map it to any number of URL by use of <tt>richlet-mapping</tt> as depicted below.
 +
 +
<source lang="xml" >
 +
<richlet-mapping>
 +
<richlet-name>Test</richlet-name>
 +
<url-pattern>/test</url-pattern>
 +
</richlet-mapping>
 +
<richlet-mapping>
 +
<richlet-name>Test</richlet-name>
 +
<url-pattern>/some/more/*</url-pattern>
 +
</richlet-mapping>
 +
</source>
 +
 +
The URL specified in the <tt>url-pattern</tt> element must start with <tt>/</tt>. If the URI ends with <tt>/*</tt>, then it is matched to all request with the same prefix. To retrieve the real request, you can check the value returned by <javadoc type="interface" method="getRequestPath()">org.zkoss.zk.ui.Page</javadoc> of the current page.
 +
 +
<source lang="java" >
 +
public void service(Page page) {
 +
    if ("/some/more/hi".equals(page.getRequestPath()) {
 +
        ...
 +
    }
 +
}
 +
</source>
 +
  
 
=Version History=
 
=Version History=

Revision as of 14:29, 26 November 2010


The richlet-mapping Element


Once a richlet is declared, you could map it to any number of URL by use of richlet-mapping as depicted below.

<richlet-mapping>
	<richlet-name>Test</richlet-name>
	<url-pattern>/test</url-pattern>
</richlet-mapping>
<richlet-mapping>
	<richlet-name>Test</richlet-name>
	<url-pattern>/some/more/*</url-pattern>
</richlet-mapping>

The URL specified in the url-pattern element must start with /. If the URI ends with /*, then it is matched to all request with the same prefix. To retrieve the real request, you can check the value returned by Page.getRequestPath() of the current page.

 public void service(Page page) {
     if ("/some/more/hi".equals(page.getRequestPath()) {
         ...
     }
 }


Version History

Last Update : 2010/11/26


Version Date Content
     



Last Update : 2010/11/26

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