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

From Documentation


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.