|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RequestInterceptor
Used to intercept the requests for the ZK Loader and Update Engine. Developers usually use it to prepare the locale and time zone.
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:
sess.setAttribute(
Attributes.PREFERRED_LOCALE
, myLocale);
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:
sess.setAttribute(
Attributes.PREFERRED_TIME_ZONE
, myLocale);
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.Note:
ExecutionInit
and others listeners, the same instance of
RequestInterceptor
is used for the whole application.
Thus, you have to make sure it can be accessed concurrently.URIInterceptor
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.
URIInterceptor
Method Summary | |
---|---|
void |
request(Session sess,
java.lang.Object request,
java.lang.Object response)
Called before a request is processed by ZK Loader or ZK Update Engine. |
Method Detail |
---|
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |