The org.zkoss.zk.ui.util.RequestInterceptor interface"

From Documentation
m (correct highlight (via JWB))
 
Line 4: Line 4:
 
  org.zkoss.zk.ui.util.RequestInterceptor
 
  org.zkoss.zk.ui.util.RequestInterceptor
  
A listener could implement <javadoc type="interface">org.zkoss.zk.ui.util.RequestInterceptor</javadoc> to intercept each request made to the ZK Loader and ZK Update Engine. Once registered, an instance of the specified class is created and shared within the whole application. Then, the <tt>request</tt> method is invoked, each time a request is received by the ZK Loader or ZK Update Engine.
+
A listener could implement <javadoc type="interface">org.zkoss.zk.ui.util.RequestInterceptor</javadoc> to intercept each request made to the ZK Loader and ZK Update Engine. Once registered, an instance of the specified class is created and shared within the whole application. Then, the <code>request</code> method is invoked, each time a request is received by the ZK Loader or ZK Update Engine.
  
 
A typical use of this interface is to determine the locale and/or time zone of the request. Please refer to [[ZK Developer's Reference/Internationalization|ZK Developer's Reference]] for the details of Internationalization.
 
A typical use of this interface is to determine the locale and/or time zone of the request. Please refer to [[ZK Developer's Reference/Internationalization|ZK Developer's Reference]] for the details of Internationalization.
Line 12: Line 12:
 
'''Note:'''
 
'''Note:'''
  
# Unlike <javadoc type="interface">org.zkoss.zk.ui.util.ExecutionInit</javadoc> and many other listeners, an instance of the registered <tt>RequestInterceptor</tt> is created at the time of registration, and then it is shared by the whole application. Thus, you have to make sure it can be accessed concurrently.
+
# Unlike <javadoc type="interface">org.zkoss.zk.ui.util.ExecutionInit</javadoc> and many other listeners, an instance of the registered <code>RequestInterceptor</code> is created at the time of registration, and then it is shared by the whole application. Thus, you have to make sure it can be accessed concurrently.
# The request parameters will be parsed with the proper locale and character encoding, after the <javadoc method="request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object)">org.zkoss.zk.ui.util.RequestInterceptor</javadoc> method is called. It is not recommended to call the <tt>getParameter</tt> or <tt>getParameterValues</tt> methods (of ''javax.servlet.ServletRequest'') in this method.
+
# The request parameters will be parsed with the proper locale and character encoding, after the <javadoc method="request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object)">org.zkoss.zk.ui.util.RequestInterceptor</javadoc> method is called. It is not recommended to call the <code>getParameter</code> or <code>getParameterValues</code> methods (of ''javax.servlet.ServletRequest'') in this method.
  
 
'''Instantiation:'''
 
'''Instantiation:'''

Latest revision as of 10:33, 19 January 2022


DocumentationZK Configuration Referencezk.xmlThe listener ElementThe org.zkoss.zk.ui.util.RequestInterceptor interface
The org.zkoss.zk.ui.util.RequestInterceptor interface


Listener:

org.zkoss.zk.ui.util.RequestInterceptor

A listener could implement RequestInterceptor to intercept each request made to the ZK Loader and ZK Update Engine. Once registered, an instance of the specified class is created and shared within the whole application. Then, the request method is invoked, each time a request is received by the ZK Loader or ZK Update Engine.

A typical use of this interface is to determine the locale and/or time zone of the request. Please refer to ZK Developer's Reference for the details of Internationalization.

You can register any number of the request interceptors (RequestInterceptor).

Note:

  1. Unlike ExecutionInit and many other listeners, an instance of the registered RequestInterceptor is created at the time of registration, and then it is shared by the whole application. Thus, you have to make sure it can be accessed concurrently.
  2. The request parameters will be parsed with the proper locale and character encoding, after the RequestInterceptor.request(Session, Object, Object) method is called. It is not recommended to call the getParameter or getParameterValues methods (of javax.servlet.ServletRequest) in this method.

Instantiation: For better performance, a single instance of the given class is instantiated when registered. It is then shared in the whole application. Thus, the implementation must be thread safe.



Last Update : 2022/01/19

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