public interface RequestInterceptor
request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object) is called at very early stage, even before
setting the locale for the request.
Thus, you can configure the locale as follows:
By default, the locale is decided by the browser's preference. However, you may want to store the previous locale in the cookie if your application is HTTP. Another example, you may want to retrieve the locale from the database where your application stores user's preferences.
Similarly, you can configure the time zone (that is used by
some components, such as Datebox) as follows:
How this interface is used.
request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object)against the instance created in the previous step.
ExecutionInitand others listeners, the same instance of
RequestInterceptoris used for the whole application. Thus, you have to make sure it can be accessed concurrently.
URIInterceptor is called when retrieving a page definition
from an URI (
PageDefinitions.getPageDefinition(org.zkoss.zk.ui.WebApp, org.zkoss.util.resource.Locator, java.lang.String)). It may or may not be caused by a client request.
On the other hand,
RequestInterceptor is called
when ZK Loader or ZK Update Engine is receiving a client request.
void request(Session sess, java.lang.Object request, java.lang.Object response)
sess- the session (never null)
request- the request (never null). It is javax.servlet.http.HttpServletRequest, if the application is HTTP based. A common use is to look for the cookies.
response- the response (never null). It is javax.servlet.http.HttpServletResponse, if the application is HTTP based. A common use is to store the cookies.
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.