ZK Filter"

From Documentation
m
m (correct highlight (via JWB))
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{ZKConfigurationReferencePageHeader}}
 +
 +
=DHtmlLayoutFilter=
 
  [Optional] Class: <javadoc>org.zkoss.zk.ui.http.DHtmlLayoutFilter</javadoc>
 
  [Optional] Class: <javadoc>org.zkoss.zk.ui.http.DHtmlLayoutFilter</javadoc>
  
<tt>DHtmlLayoutFilter</tt> is a filter to post-process the output generated by other servlets, such as JSP pages. Its role is similar to the ZK Loader. Unlike the ZK Loader, which loads static ZUML pages from Web applications directly, the ZK filter is designed to process dynamic pages generated by other servlets, say JSP or JSF. It enables developers to add rich user interfaces to existent servlets written in any technology.
+
ZK Filter is a filter to post-process the output generated by other servlets, such as JSP pages. Its role is similar to the ZK Loader. Unlike the ZK Loader, which loads static ZUML pages from Web applications directly, the ZK filter is designed to process dynamic pages generated by other servlets, say JSP or JSF. It enables developers to add rich user interfaces to existent servlets written in any technology.
  
 
'''Note:''' the output must be in XHTML (or ZUML) syntax. If you encounter any problem, you can save the generated output into a ZHTML page and then browse the URL whether the ZHTML page is stored.
 
'''Note:''' the output must be in XHTML (or ZUML) syntax. If you encounter any problem, you can save the generated output into a ZHTML page and then browse the URL whether the ZHTML page is stored.
  
=== The Initial Parameters ===
+
= The Initial Parameters =
  
 
{| border="1"
 
{| border="1"
Line 13: Line 16:
 
|-
 
|-
 
|  extension
 
|  extension
|  [Optional][Default: <tt>html</tt>]
+
|  [Optional][Default: <code>html</code>]
  
 
It specifies how to process the response generated by other servlets.
 
It specifies how to process the response generated by other servlets.
  
If <tt>html</tt> or <tt>zhtml</tt>, XHTML is assumed to be the default namespace. If <tt>xul</tt> or <tt>zul</tt>, XUL is assumed to be the default namespace.
+
If <code>html</code> or <code>zhtml</code>, XHTML is assumed to be the default namespace. If <code>xul</code> or <code>zul</code>, XUL is assumed to be the default namespace.
  
 
|-
 
|-
 
|  charset
 
|  charset
| [Optional][Default: <tt>UTF-8</tt>]
+
| [Optional][Default: <code>UTF-8</code>]
  
 
It specifies the default charset for the output of this filter.
 
It specifies the default charset for the output of this filter.
  
If an empty string is specified as follows, the container's default is used. In other words, the <tt>setCharacterEncoding</tt> method of ''javax.servlet.ServletResponse'' is not called.
+
If an empty string is specified as follows, the container's default is used. In other words, the <code>setCharacterEncoding</code> method of ''javax.servlet.ServletResponse'' is not called.
  
 
  <param-value></param-value>
 
  <param-value></param-value>
Line 31: Line 34:
 
|-
 
|-
 
|  compress
 
|  compress
| [Optional][Default: <tt>true</tt>]
+
| [Optional][Default: <code>true</code>]
  
It specifies whether to compress the output if the browser supports the compression (<tt>Accept-Encoding</tt>) and this filter is not included by other Servlets.
+
It specifies whether to compress the output if the browser supports the compression (<code>Accept-Encoding</code>) and this filter is not included by other Servlets.
  
 
|}
 
|}
  
=== How to Specify in web.xml ===
+
= Map URL to ZK Filter =
 +
 
 +
ZK Filter can be mapped to any servlet or JSP page you want. For example,
  
 
<source lang="xml" >
 
<source lang="xml" >
<filter>
+
<filter>
    <filter-name>zkFilter</filter-name>
+
<filter-name>zkFilter</filter-name>
    <filter-class>org.zkoss.zk.ui.http.DHtmlLayoutFilter</filter-class>
+
<filter-class>org.zkoss.zk.ui.http.DHtmlLayoutFilter</filter-class>
</filter>
+
</filter>
 +
<filter-mapping>
 +
<filter-name>zkFilter</filter-name>
 +
<url-pattern>/foo/whatever.jsp</url-pattern>
 +
</filter-mapping>
 +
<filter-mapping>
 +
<filter-name>zkFilter</filter-name>
 +
<url-pattern>/foo2/*</url-pattern>
 +
</filter-mapping>
 
</source>
 
</source>
 +
 +
=Version History=
 +
 +
{| border='1px' | width="100%"
 +
! Version !! Date !! Content
 +
|-
 +
| &nbsp;
 +
| &nbsp;
 +
| &nbsp;
 +
|}
 +
 +
{{ZKConfigurationReferencePageFooter}}

Latest revision as of 10:18, 19 January 2022


DHtmlLayoutFilter

[Optional] Class: DHtmlLayoutFilter

ZK Filter is a filter to post-process the output generated by other servlets, such as JSP pages. Its role is similar to the ZK Loader. Unlike the ZK Loader, which loads static ZUML pages from Web applications directly, the ZK filter is designed to process dynamic pages generated by other servlets, say JSP or JSF. It enables developers to add rich user interfaces to existent servlets written in any technology.

Note: the output must be in XHTML (or ZUML) syntax. If you encounter any problem, you can save the generated output into a ZHTML page and then browse the URL whether the ZHTML page is stored.

The Initial Parameters

init-param
Descriptions
extension [Optional][Default: html]

It specifies how to process the response generated by other servlets.

If html or zhtml, XHTML is assumed to be the default namespace. If xul or zul, XUL is assumed to be the default namespace.

charset [Optional][Default: UTF-8]

It specifies the default charset for the output of this filter.

If an empty string is specified as follows, the container's default is used. In other words, the setCharacterEncoding method of javax.servlet.ServletResponse is not called.

<param-value></param-value>
compress [Optional][Default: true]

It specifies whether to compress the output if the browser supports the compression (Accept-Encoding) and this filter is not included by other Servlets.

Map URL to ZK Filter

ZK Filter can be mapped to any servlet or JSP page you want. For example,

	<filter>
		<filter-name>zkFilter</filter-name>
		<filter-class>org.zkoss.zk.ui.http.DHtmlLayoutFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>zkFilter</filter-name>
		<url-pattern>/foo/whatever.jsp</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>zkFilter</filter-name>
		<url-pattern>/foo2/*</url-pattern>
	</filter-mapping>

Version History

Version Date Content
     



Last Update : 2022/01/19

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