org.zkoss.zk.ui.util
Class Configuration

java.lang.Object
  extended by org.zkoss.zk.ui.util.Configuration

public class Configuration
extends java.lang.Object

The ZK configuration.

To retrieve the current configuration, use WebApp.getConfiguration().

Note: A Configuration instance can be assigned to at most one WebApp instance.

Author:
tomyeh

Constructor Summary
Configuration()
          Contructor.
 
Method Summary
 java.lang.String addClientErrorReload(int errCode, java.lang.String uri)
          Adds the URI to redirect to, when ZK Client Engine receives an error.
 void addDisabledThemeURI(java.lang.String uri)
          Enables or disables the default theme of the specified language.
 void addErrorPage(java.lang.Class type, java.lang.String location)
          Deprecated. As of release 2.4.1, replaced by addErrorPage(String, Class, String)
 java.lang.String addErrorPage(java.lang.String deviceType, java.lang.Class type, java.lang.String location)
          Adds an error page.
 void addListener(java.lang.Class klass)
          Adds a listener class.
 java.lang.Object addRichlet(java.lang.String name, java.lang.Class richletClass, java.util.Map params)
          Adds the definition of a richlet.
 java.lang.Object addRichlet(java.lang.String name, java.lang.String richletClassName, java.util.Map params)
          Adds the definition of a richlet.
 void addRichletMapping(java.lang.String name, java.lang.String path)
          Adds a richlet mapping.
 void addThemeURI(java.lang.String uri)
          Adds an CSS resource that will be generated for each ZUML desktop.
 void afterProcessEvent(Event event)
          Invokes EventInterceptor.afterProcessEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.
 Event beforePostEvent(Event event)
          Invokes EventInterceptor.beforePostEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.
 Event beforeProcessEvent(Event event)
          Invokes EventInterceptor.beforeProcessEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.
 Event beforeSendEvent(Event event)
          Invokes EventInterceptor.beforeSendEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.
 void detroyRichlets()
          Destroyes all richlets.
 void enableDisableBehindModal(boolean enable)
          Sets whether to disable the components that don't belong to the active modal window.
 void enableEventThread(boolean enable)
          Sets whether to use the event processing thread.
 java.lang.String getClientErrorReload(int errCode)
          Returns the URI that is associated with the specified error code, or null if no URI is associated.
 int[] getClientErrorReloadCodes()
          Returns a readonly array of all error codes that are associated with URI to redirect to.
 java.lang.Class getDesktopCacheProviderClass()
          Returns the class that implements the UI engine, or null if default is used.
 int getDesktopMaxInactiveInterval()
          Returns the time, in seconds, between client requests before ZK will invalidate the desktop.
 java.util.Set getDisabledThemeURIs()
          Returns a set of the theme URIs that are disabled (never null).
 java.lang.String getErrorPage(java.lang.String deviceType, java.lang.Throwable error)
          Returns the error page that matches the specified error, or null if not found.
 java.lang.String getErrorPage(java.lang.Throwable error)
          Deprecated. As of release 2.4.1, replaced by getErrorPage(String, Throwable).
 java.lang.Class getExpressionFactoryClass()
          Returns the implementation of the expression factory that is used by the whole system, or null if the sytem default is used.
 java.lang.Class getFailoverManagerClass()
          Returns the class that implements the failover manger, or null if no custom failover mechanism.
 java.lang.Class getIdGeneratorClass()
          Returns the class that implements IdGenerator, or null if default is used.
 int getMaxDesktops()
          Returns the maximal allowed number of desktop per session.
 int getMaxProcessTime()
          Returns the maximal allowed time to process events, in miliseconds.
 int getMaxSpareThreads()
          Returns the maximal allowed number of the spare pool for queuing event processing threads (per Web application).
 int getMaxSuspendedThreads()
          Returns the maximal allowed number of suspended event processing threads (per Web application).
 int getMaxUploadSize()
          Returns the maximal allowed upload size, in kilobytes, or a negative value if no limit.
 Monitor getMonitor()
          Returns the monitor for this application, or null if not set.
 PerformanceMeter getPerformanceMeter()
          Returns the performance meter for this application, or null if not set.
 java.lang.String getPreference(java.lang.String name, java.lang.String defaultValue)
          Returns the value of the preference defined in zk.xml, or by setPreference(java.lang.String, java.lang.String).
 java.util.Set getPreferenceNames()
          Returns a readonly set of all preference names.
 int getProcessingPromptDelay()
          Returns the time, in milliseconds, before ZK Client Engine shows a dialog to prompt users that the request is in processming.
 java.lang.String getResponseCharset()
          Returns the charset used to generate the HTTP response or null to use the container's default.
 Richlet getRichlet(java.lang.String name)
          Returns an instance of richlet of the specified name, or null if not found.
 Richlet getRichletByPath(java.lang.String path)
          Returns an instance of richlet for the specified path, or null if not found.
 int getSessionMaxInactiveInterval()
          Returns the time, in seconds, between client requests before ZK will invalidate the session.
 ThemeProvider getThemeProvider()
          Returns the theme provider for the current execution, or null if not available.
 java.lang.String[] getThemeURIs()
          Returns a readonly list of the URI of the CSS resources that will be generated for each ZUML desktop (never null).
 java.lang.String getTimeoutURI()
          Deprecated. As of release 2.4.0, replaced by Devices.getTimeoutURI(java.lang.String).
 int getTooltipDelay()
          Returns the time, in milliseconds, before ZK Client Engine shows the tooltip when a user moves the mouse over particual UI components.
 java.lang.Class getUiEngineClass()
          Returns the class that implements UiEngine, or null if default is used.
 java.lang.Class getUiFactoryClass()
          Returns the class that implements the UI engine, or null if default is used.
 java.lang.String getUploadCharset()
          Returns the charset used to encode the uploaded text file (never null).
 CharsetFinder getUploadCharsetFinder()
          Returns the finder that is used to decide the character set for the uploaded text filie(s), or null if not available.
 WebApp getWebApp()
          Returns the Web application that this configuration belongs to, or null if it is not associated yet.
 java.lang.Class getWebAppClass()
          Returns the class that implements WebApp and WebAppCtrl, or null if default is used.
 void invokeDesktopCleanups(Desktop desktop)
          Invokes DesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop) for each relevant listener registered by addListener(java.lang.Class).
 void invokeDesktopInits(Desktop desktop)
          Invokes DesktopInit.init(org.zkoss.zk.ui.Desktop) for each relevant listener registered by addListener(java.lang.Class).
 void invokeEventThreadCompletes(java.util.List cleanups, Component comp, Event evt, java.util.List errs)
          Invoke EventThreadCleanup.complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each instance returned by newEventThreadCleanups(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List).
 boolean invokeEventThreadInits(java.util.List inits, Component comp, Event evt)
          Invokes EventThreadInit.init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each instance returned by newEventThreadInits(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).
 void invokeEventThreadResumeAborts(Component comp, Event evt)
          Invokes EventThreadResume.abortResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).
 void invokeEventThreadResumes(java.util.List resumes, Component comp, Event evt)
          Invokes EventThreadResume.afterResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each instance returned by newEventThreadResumes(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).
 void invokeEventThreadSuspends(java.util.List suspends, Component comp, Event evt)
          Invokes EventThreadSuspend.afterSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).
 void invokeExecutionCleanups(Execution exec, Execution parent, java.util.List errs)
          Invokes ExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List) for each relevant listener registered by addListener(java.lang.Class).
 void invokeExecutionInits(Execution exec, Execution parent)
          Invokes ExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution) for each relevant listener registered by addListener(java.lang.Class).
 void invokeRequestInterceptors(Session sess, java.lang.Object request, java.lang.Object response)
          Invokes RequestInterceptor.request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object) for each relevant listner registered by addListener(java.lang.Class).
 void invokeSessionCleanups(Session sess)
          Invokes SessionCleanup.cleanup(org.zkoss.zk.ui.Session) for each relevant listener registered by addListener(java.lang.Class).
 void invokeSessionInits(Session sess)
          Invokes SessionInit.init(org.zkoss.zk.ui.Session) for each relevant listener registered by addListener(java.lang.Class).
 void invokeURIInterceptors(java.lang.String uri)
          Invokes URIInterceptor.request(java.lang.String) for each relevant listner registered by addListener(java.lang.Class).
 void invokeWebAppCleanups()
          Invokes WebAppCleanup.cleanup(org.zkoss.zk.ui.WebApp) for each relevant listener registered by addListener(java.lang.Class).
 void invokeWebAppInits()
          Invokes WebAppInit.init(org.zkoss.zk.ui.WebApp) for each relevant listener registered by addListener(java.lang.Class).
 boolean isDisableBehindModalEnabled()
          Returns whether to disable the components that don't belong to the active modal window.
 boolean isEventThreadEnabled()
          Returns whether to use the event processing thread.
 boolean isKeepDesktopAcrossVisits()
          Returns whether to keep the desktops across visits.
 boolean isTimerKeepAlive()
          Returns whether to keep the session alive, when receiving the onTimer event.
 java.util.List newEventThreadCleanups(Component comp, Event evt, java.util.List errs)
          Invokes EventThreadCleanup.cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List) for each relevant listener registered by addListener(java.lang.Class).
 java.util.List newEventThreadInits(Component comp, Event evt)
          Contructs a list of EventThreadInit instances and invokes EventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).
 java.util.List newEventThreadResumes(Component comp, Event evt)
          Contructs a list of EventThreadResume instances and invokes EventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).
 java.util.List newEventThreadSuspends(Component comp, Event evt, java.lang.Object obj)
          Constructs a list of EventThreadSuspend instances and invokes EventThreadSuspend.beforeSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object) for each relevant listener registered by addListener(java.lang.Class).
 java.lang.String removeClientErrorReload(int errCode)
          Removes the URI to redirect to, when ZK Client Engine receives an error.
 void removeListener(java.lang.Class klass)
          Removes a listener class.
 void setDesktopCacheProviderClass(java.lang.Class cls)
          Sets the class that implements DesktopCacheProvider, or null to use the default.
 void setDesktopMaxInactiveInterval(int secs)
          Specifies the time, in seconds, between client requests before ZK will invalidate the desktop.
 void setExpressionFactoryClass(java.lang.Class expfcls)
          Sets the implementation of the expression factory that shall be used by the whole system.
 void setFailoverManagerClass(java.lang.Class cls)
          Sets the class that implements FailoverManager, or null if no custom failover mechanism.
 void setIdGeneratorClass(java.lang.Class cls)
          Sets the class that implements IdGenerator, or null to use the default.
 void setKeepDesktopAcrossVisits(boolean keep)
          Specifies whether to keep the desktops across visits.
 void setMaxDesktops(int max)
          Specifies the maximal allowed number of desktop per session.
 void setMaxProcessTime(int time)
          Specifies the maximal allowed time to process events, in miliseconds.
 void setMaxSpareThreads(int max)
          Specifies the maximal allowed number of the spare pool for queuing the event processing threads (per Web application).
 void setMaxSuspendedThreads(int max)
          Specifies the maximal allowed number of suspended event processing threads (per Web application).
 void setMaxUploadSize(int sz)
          Specifies the maximal allowed upload size, in kilobytes.
 Monitor setMonitor(Monitor monitor)
          Sets the monitor for this application, or null to disable it.
 PerformanceMeter setPerformanceMeter(PerformanceMeter meter)
          Sets the performance meter for this application, or null to disable it.
 void setPreference(java.lang.String name, java.lang.String value)
          Sets the value of the preference.
 void setProcessingPromptDelay(int minisecs)
          Specifies the time, in milliseconds, before ZK Client Engine shows a dialog to prompt users that the request is in processming.
 void setResponseCharset(java.lang.String charset)
          Sets the charset used to generate HTTP response.
 void setSessionMaxInactiveInterval(int secs)
          Specifies the time, in seconds, between client requests before ZK will invalidate the session.
 void setThemeProvider(ThemeProvider provider)
          Sets the theme provider for the current execution, or null if not available.
 void setTimeoutURI(java.lang.String uri)
          Deprecated. As of release 2.4.0, replaced by Devices.setTimeoutURI(java.lang.String, java.lang.String).
 void setTimerKeepAlive(boolean alive)
          Specifies whether to keep the session alive, when receiving the onTimer event.
 void setTooltipDelay(int minisecs)
          Specifies the time, in milliseconds, before ZK Client Engine shows the tooltip when a user moves the mouse over particual UI components.
 void setUiEngineClass(java.lang.Class cls)
          Sets the class that implements UiEngine, or null to use the default.
 void setUiFactoryClass(java.lang.Class cls)
          Sets the class that implements UiFactory, or null to use the default.
 void setUploadCharset(java.lang.String charset)
          Sets the charset used to encode the upload text file.
 void setUploadCharsetFinder(CharsetFinder finder)
          Sets the finder that is used to decide the character set for the uploaded text filie(s), or null if not available.
 void setWebApp(WebApp wapp)
          Associates it with a web application.
 void setWebAppClass(java.lang.Class cls)
          Sets the class that implements WebApp and WebAppCtrl, or null to use the default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Contructor.

Method Detail

getWebApp

public WebApp getWebApp()
Returns the Web application that this configuration belongs to, or null if it is not associated yet.


setWebApp

public void setWebApp(WebApp wapp)
Associates it with a web application.


addListener

public void addListener(java.lang.Class klass)
                 throws java.lang.Exception
Adds a listener class.

Parameters:
klass - the listener class must implement at least one of Monitor, PerformanceMeter, EventThreadInit, EventThreadCleanup, EventThreadSuspend, EventThreadResume, WebAppInit, WebAppCleanup, SessionInit, SessionCleanup, DesktopInit, DesktopCleanup, ExecutionInit, ExecutionCleanup, URIInterceptor, RequestInterceptor, EventInterceptor interfaces.
Throws:
java.lang.Exception

removeListener

public void removeListener(java.lang.Class klass)
Removes a listener class.


newEventThreadInits

public java.util.List newEventThreadInits(Component comp,
                                          Event evt)
                                   throws UiException
Contructs a list of EventThreadInit instances and invokes EventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).

Used only internally (by UiEngine before starting an event processing thread).

Returns:
a list of EventThreadInit instances that are constructed in this method (and their EventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) are called successfully), or null.
Throws:
UiException - to prevent a thread from being processed if EventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) throws an exception

invokeEventThreadInits

public boolean invokeEventThreadInits(java.util.List inits,
                                      Component comp,
                                      Event evt)
                               throws UiException
Invokes EventThreadInit.init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each instance returned by newEventThreadInits(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).

Used only internally.

Parameters:
inits - a list of EventThreadInit instances returned from newEventThreadInits(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), or null if no instance at all.
comp - the component which the event is targeting
evt - the event to process
Returns:
false if you want to ignore the event, i.e., not to proceed any event processing for the specified event (evt).
Throws:
UiException - to prevent a thread from being processed if EventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) throws an exception

newEventThreadCleanups

public java.util.List newEventThreadCleanups(Component comp,
                                             Event evt,
                                             java.util.List errs)
Invokes EventThreadCleanup.cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of EventThreadCleanup is constructed first, and then invoke EventThreadCleanup.cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List).

It never throws an exception but logs and adds it to the errs argument, if not null.

Parameters:
comp - the component which the event is targeting
evt - the event to process
errs - a list of exceptions (java.lang.Throwable) if any exception occured before this method is called, or null if no exeption at all. Note: you can manipulate the list directly to add or clean up exceptions. For example, if exceptions are fixed correctly, you can call errs.clear() such that no error message will be displayed at the client.
Returns:
a list of EventThreadCleanup, or null

invokeEventThreadCompletes

public void invokeEventThreadCompletes(java.util.List cleanups,
                                       Component comp,
                                       Event evt,
                                       java.util.List errs)
Invoke EventThreadCleanup.complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each instance returned by newEventThreadCleanups(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List).

Used only internally.

It never throws an exception but logs and adds it to the errs argument, if not null.

Parameters:
cleanups - a list of EventThreadCleanup instances returned from newEventThreadCleanups(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List), or null if no instance at all.
errs - used to hold the exceptions that are thrown by EventThreadCleanup.complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event). If null, all exceptions are ignored (but logged).

newEventThreadSuspends

public java.util.List newEventThreadSuspends(Component comp,
                                             Event evt,
                                             java.lang.Object obj)
Constructs a list of EventThreadSuspend instances and invokes EventThreadSuspend.beforeSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

Note: caller shall execute in the event processing thread.

Parameters:
comp - the component which the event is targeting
evt - the event to process
obj - which object that Executions.wait(java.lang.Object) is called with.
Returns:
a list of EventThreadSuspend, or null
Throws:
UiException - to prevent a thread from suspending

invokeEventThreadSuspends

public void invokeEventThreadSuspends(java.util.List suspends,
                                      Component comp,
                                      Event evt)
                               throws UiException
Invokes EventThreadSuspend.afterSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class). Unlike invokeEventThreadSuspends(java.util.List, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), caller shall execute in the main thread (aka, servlet thread).

Used only internally.

Unlike invokeEventThreadSuspends(java.util.List, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), exceptions are logged and ignored.

Parameters:
suspends - a list of EventThreadSuspend instances returned from newEventThreadSuspends(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object), or null if no instance at all.
comp - the component which the event is targeting
evt - the event to process
Throws:
UiException

newEventThreadResumes

public java.util.List newEventThreadResumes(Component comp,
                                            Event evt)
                                     throws UiException
Contructs a list of EventThreadResume instances and invokes EventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).

Used only internally (by UiEngine when resuming a suspended event thread). Notice: it executes in the main thread (i.e., the servlet thread).

Parameters:
comp - the component which the event is targeting
evt - the event to process
Returns:
a list of EventThreadResume instances that are constructed in this method (and their EventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) are called successfully), or null.
Throws:
UiException - to prevent a thread from being resumed if EventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) throws an exception

invokeEventThreadResumes

public void invokeEventThreadResumes(java.util.List resumes,
                                     Component comp,
                                     Event evt)
                              throws UiException
Invokes EventThreadResume.afterResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each instance returned by newEventThreadResumes(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).

Used only internally.

It never throws an exception but logs and adds it to the errs argument, if not null.

Parameters:
resumes - a list of EventThreadResume instances returned from newEventThreadResumes(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), or null if no instance at all.
comp - the component which the event is targeting
evt - the event to process If null, all exceptions are ignored (but logged)
Throws:
UiException

invokeEventThreadResumeAborts

public void invokeEventThreadResumeAborts(Component comp,
                                          Event evt)
Invokes EventThreadResume.abortResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of EventThreadResume is constructed first, and then invoke EventThreadResume.abortResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).

It never throws an exception but logging.

Parameters:
comp - the component which the event is targeting
evt - the event to process

invokeWebAppInits

public void invokeWebAppInits()
                       throws UiException
Invokes WebAppInit.init(org.zkoss.zk.ui.WebApp) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of WebAppInit is constructed first, and then invoke WebAppInit.init(org.zkoss.zk.ui.WebApp).

Unlike invokeWebAppInits(), it doesn't throw any exceptions. Rather, it only logs them.

Throws:
UiException

invokeWebAppCleanups

public void invokeWebAppCleanups()
Invokes WebAppCleanup.cleanup(org.zkoss.zk.ui.WebApp) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of WebAppCleanup is constructed first, and then invoke WebAppCleanup.cleanup(org.zkoss.zk.ui.WebApp).

It never throws an exception.


invokeSessionInits

public void invokeSessionInits(Session sess)
                        throws UiException
Invokes SessionInit.init(org.zkoss.zk.ui.Session) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of SessionInit is constructed first, and then invoke SessionInit.init(org.zkoss.zk.ui.Session).

Parameters:
sess - the session that is created
Throws:
UiException - to prevent a session from being created

invokeSessionCleanups

public void invokeSessionCleanups(Session sess)
Invokes SessionCleanup.cleanup(org.zkoss.zk.ui.Session) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of SessionCleanup is constructed first, and then invoke SessionCleanup.cleanup(org.zkoss.zk.ui.Session).

It never throws an exception.

Parameters:
sess - the session that is being destroyed

invokeDesktopInits

public void invokeDesktopInits(Desktop desktop)
                        throws UiException
Invokes DesktopInit.init(org.zkoss.zk.ui.Desktop) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of DesktopInit is constructed first, and then invoke DesktopInit.init(org.zkoss.zk.ui.Desktop).

Parameters:
desktop - the desktop that is created
Throws:
UiException - to prevent a desktop from being created

invokeDesktopCleanups

public void invokeDesktopCleanups(Desktop desktop)
Invokes DesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of DesktopCleanup is constructed first, and then invoke DesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop).

It never throws an exception.

Parameters:
desktop - the desktop that is being destroyed

invokeExecutionInits

public void invokeExecutionInits(Execution exec,
                                 Execution parent)
                          throws UiException
Invokes ExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of ExecutionInit is constructed first, and then invoke ExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution).

Parameters:
exec - the execution that is created
parent - the previous execution, or null if no previous at all
Throws:
UiException - to prevent an execution from being created

invokeExecutionCleanups

public void invokeExecutionCleanups(Execution exec,
                                    Execution parent,
                                    java.util.List errs)
Invokes ExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List) for each relevant listener registered by addListener(java.lang.Class).

Used only internally.

An instance of ExecutionCleanup is constructed first, and then invoke ExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List).

It never throws an exception but logs and adds it to the errs argument, if not null.

Parameters:
exec - the execution that is being destroyed
parent - the previous execution, or null if no previous at all
errs - a list of exceptions (java.lang.Throwable) if any exception occured before this method is called, or null if no exeption at all. Note: you can manipulate the list directly to add or clean up exceptions. For example, if exceptions are fixed correctly, you can call errs.clear() such that no error message will be displayed at the client.

invokeURIInterceptors

public void invokeURIInterceptors(java.lang.String uri)
Invokes URIInterceptor.request(java.lang.String) for each relevant listner registered by addListener(java.lang.Class).

Used only internally.

If any of them throws an exception, the exception is propogated to the caller.

Throws:
UiException - if it is rejected by the interceptor. Use Throwable.getCause() to retrieve the cause.

invokeRequestInterceptors

public void invokeRequestInterceptors(Session sess,
                                      java.lang.Object request,
                                      java.lang.Object response)
Invokes RequestInterceptor.request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object) for each relevant listner registered by addListener(java.lang.Class).

Used only internally.

If any of them throws an exception, the exception is propogated to the caller.

Throws:
UiException - if it is rejected by the interceptor. Use Throwable.getCause() to retrieve the cause.

addThemeURI

public void addThemeURI(java.lang.String uri)
Adds an CSS resource that will be generated for each ZUML desktop.

Note: if ThemeProvider is specified (setThemeProvider(org.zkoss.zk.ui.util.ThemeProvider)), the final theme URIs generated depend on ThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List).


getThemeURIs

public java.lang.String[] getThemeURIs()
Returns a readonly list of the URI of the CSS resources that will be generated for each ZUML desktop (never null).

Default: an array with zero length.


addDisabledThemeURI

public void addDisabledThemeURI(java.lang.String uri)
Enables or disables the default theme of the specified language.

Note: if ThemeProvider is specified (setThemeProvider(org.zkoss.zk.ui.util.ThemeProvider)), the final theme URIs generated depend on ThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List).

Parameters:
uri - the theme URI to disable
Since:
3.0.0

getDisabledThemeURIs

public java.util.Set getDisabledThemeURIs()
Returns a set of the theme URIs that are disabled (never null).

Since:
3.0.0
See Also:
addDisabledThemeURI(java.lang.String)

getThemeProvider

public ThemeProvider getThemeProvider()
Returns the theme provider for the current execution, or null if not available.

Default: null.

Note: if specified, the final theme URIs is decided by the provider. The URIs specified in getThemeURIs() are passed to provider, and it has no effect if the provider decides to ignore them.

Since:
3.0.0
See Also:
getThemeURIs(), getDisabledThemeURIs()

setThemeProvider

public void setThemeProvider(ThemeProvider provider)
Sets the theme provider for the current execution, or null if not available.

Parameters:
provider - the theme provide. If null, the default theme URIs will be used.
Since:
3.0.0
See Also:
getThemeProvider()

setTimeoutURI

public void setTimeoutURI(java.lang.String uri)
Deprecated. As of release 2.4.0, replaced by Devices.setTimeoutURI(java.lang.String, java.lang.String).


getTimeoutURI

public java.lang.String getTimeoutURI()
Deprecated. As of release 2.4.0, replaced by Devices.getTimeoutURI(java.lang.String).


setUiEngineClass

public void setUiEngineClass(java.lang.Class cls)
Sets the class that implements UiEngine, or null to use the default.


getUiEngineClass

public java.lang.Class getUiEngineClass()
Returns the class that implements UiEngine, or null if default is used.


setWebAppClass

public void setWebAppClass(java.lang.Class cls)
Sets the class that implements WebApp and WebAppCtrl, or null to use the default.

Note: you have to set the class before WebApp is created. Otherwise, it won't have any effect.


getWebAppClass

public java.lang.Class getWebAppClass()
Returns the class that implements WebApp and WebAppCtrl, or null if default is used.


setDesktopCacheProviderClass

public void setDesktopCacheProviderClass(java.lang.Class cls)
Sets the class that implements DesktopCacheProvider, or null to use the default.

Note: you have to set the class before WebApp is created. Otherwise, it won't have any effect.


getDesktopCacheProviderClass

public java.lang.Class getDesktopCacheProviderClass()
Returns the class that implements the UI engine, or null if default is used.


setUiFactoryClass

public void setUiFactoryClass(java.lang.Class cls)
Sets the class that implements UiFactory, or null to use the default.

Note: you have to set the class before WebApp is created. Otherwise, it won't have any effect.


getUiFactoryClass

public java.lang.Class getUiFactoryClass()
Returns the class that implements the UI engine, or null if default is used.


setFailoverManagerClass

public void setFailoverManagerClass(java.lang.Class cls)
Sets the class that implements FailoverManager, or null if no custom failover mechanism.

Note: you have to set the class before WebApp is created. Otherwise, it won't have any effect.


getFailoverManagerClass

public java.lang.Class getFailoverManagerClass()
Returns the class that implements the failover manger, or null if no custom failover mechanism.


setIdGeneratorClass

public void setIdGeneratorClass(java.lang.Class cls)
Sets the class that implements IdGenerator, or null to use the default.

Note: you have to set the class before WebApp is created. Otherwise, it won't have any effect.

Since:
2.4.1

getIdGeneratorClass

public java.lang.Class getIdGeneratorClass()
Returns the class that implements IdGenerator, or null if default is used.

Since:
2.4.1

setMaxProcessTime

public void setMaxProcessTime(int time)
Specifies the maximal allowed time to process events, in miliseconds. ZK will keep processing the requests sent from the client until all requests are processed, or the maximal allowed time expires.

Default: 3000.

Parameters:
time - the maximal allowed time to process events. It must be positive.

getMaxProcessTime

public int getMaxProcessTime()
Returns the maximal allowed time to process events, in miliseconds. It is always positive


setMaxUploadSize

public void setMaxUploadSize(int sz)
Specifies the maximal allowed upload size, in kilobytes.

Default: 5120.

Parameters:
sz - the maximal allowed upload size. A negative value indicates therre is no limit.

getMaxUploadSize

public int getMaxUploadSize()
Returns the maximal allowed upload size, in kilobytes, or a negative value if no limit.


getUploadCharset

public java.lang.String getUploadCharset()
Returns the charset used to encode the uploaded text file (never null).

Default: UTF-8.

See Also:
getUploadCharsetFinder()

setUploadCharset

public void setUploadCharset(java.lang.String charset)
Sets the charset used to encode the upload text file.

Note: setUploadCharsetFinder(org.zkoss.zk.ui.util.CharsetFinder) has the higher priority.

Parameters:
charset - the charset to use. If null or empty, UTF-8 is assumed.
See Also:
setUploadCharsetFinder(org.zkoss.zk.ui.util.CharsetFinder)

getUploadCharsetFinder

public CharsetFinder getUploadCharsetFinder()
Returns the finder that is used to decide the character set for the uploaded text filie(s), or null if not available.

Default: null

Since:
3.0.0
See Also:
getUploadCharset()

setUploadCharsetFinder

public void setUploadCharsetFinder(CharsetFinder finder)
Sets the finder that is used to decide the character set for the uploaded text filie(s), or null if not available.

It has the higher priority than setUploadCharset(java.lang.String). In other words, getUploadCharset() is used only if this method returns null or CharsetFinder.getCharset(java.lang.String, java.io.InputStream) returns null.

Since:
3.0.0
See Also:
setUploadCharset(java.lang.String)

setDesktopMaxInactiveInterval

public void setDesktopMaxInactiveInterval(int secs)
Specifies the time, in seconds, between client requests before ZK will invalidate the desktop.

Default: 3600 (1 hour).

A negative value indicates the desktop should never timeout.


getDesktopMaxInactiveInterval

public int getDesktopMaxInactiveInterval()
Returns the time, in seconds, between client requests before ZK will invalidate the desktop.

A negative value indicates the desktop should never timeout.


setProcessingPromptDelay

public void setProcessingPromptDelay(int minisecs)
Specifies the time, in milliseconds, before ZK Client Engine shows a dialog to prompt users that the request is in processming.

Default: 900


getProcessingPromptDelay

public int getProcessingPromptDelay()
Returns the time, in milliseconds, before ZK Client Engine shows a dialog to prompt users that the request is in processming.


setTooltipDelay

public void setTooltipDelay(int minisecs)
Specifies the time, in milliseconds, before ZK Client Engine shows the tooltip when a user moves the mouse over particual UI components.

Default: 800


getTooltipDelay

public int getTooltipDelay()
Returns the time, in milliseconds, before ZK Client Engine shows the tooltip when a user moves the mouse over particual UI components.


addClientErrorReload

public java.lang.String addClientErrorReload(int errCode,
                                             java.lang.String uri)
Adds the URI to redirect to, when ZK Client Engine receives an error.

Parameters:
errCode - the error code.
uri - the URI to redirect to. It cannot be null. If empty, the client will reload the same page again. If null, it is the same as removeClientErrorReload(int)
Returns:
the previous URI associated with the specified error code
Since:
3.0.0

removeClientErrorReload

public java.lang.String removeClientErrorReload(int errCode)
Removes the URI to redirect to, when ZK Client Engine receives an error.

Parameters:
errCode - the error code.
Returns:
the previous URI associated with the specified error code
Since:
3.0.0

getClientErrorReload

public java.lang.String getClientErrorReload(int errCode)
Returns the URI that is associated with the specified error code, or null if no URI is associated.

Since:
3.0.0

getClientErrorReloadCodes

public int[] getClientErrorReloadCodes()
Returns a readonly array of all error codes that are associated with URI to redirect to.

Default: 302, 401 and 403 are associated with an empty URI.

Since:
3.0.0

setSessionMaxInactiveInterval

public void setSessionMaxInactiveInterval(int secs)
Specifies the time, in seconds, between client requests before ZK will invalidate the session.

Default: 0 (means the system default).

See Also:
setTimerKeepAlive(boolean), Session.setMaxInactiveInterval(int)

getSessionMaxInactiveInterval

public int getSessionMaxInactiveInterval()
Returns the time, in seconds, between client requests before ZK will invalidate the session.

Default: 0 (means the system default).

A negative value indicates that there is no limit. Zero means to use the system default (usually defined in web.xml).

See Also:
isTimerKeepAlive(), Session.getMaxInactiveInterval()

setMaxDesktops

public void setMaxDesktops(int max)
Specifies the maximal allowed number of desktop per session.

Defafult: 10.

A negative value indicates there is no limit.


getMaxDesktops

public int getMaxDesktops()
Returns the maximal allowed number of desktop per session.

A negative value indicates there is no limit.


setMaxSpareThreads

public void setMaxSpareThreads(int max)
Specifies the maximal allowed number of the spare pool for queuing the event processing threads (per Web application).

Default: 100.

A negative value indicates there is no limit.

ZK uses a thread pool to keep the idle event processing threads. It speeds up the service of an event by reusing the thread queued in this pool.

See Also:
setMaxSuspendedThreads(int), isEventThreadEnabled()

getMaxSpareThreads

public int getMaxSpareThreads()
Returns the maximal allowed number of the spare pool for queuing event processing threads (per Web application).

See Also:
isEventThreadEnabled()

setMaxSuspendedThreads

public void setMaxSuspendedThreads(int max)
Specifies the maximal allowed number of suspended event processing threads (per Web application).

Default: -1 (no limit).

A negative value indicates there is no limit.

It is ignored if the use of the event processing thread is disable (isEventThreadEnabled().


getMaxSuspendedThreads

public int getMaxSuspendedThreads()
Returns the maximal allowed number of suspended event processing threads (per Web application).

It is ignored if the use of the event processing thread is disable (isEventThreadEnabled().

See Also:
isEventThreadEnabled()

enableEventThread

public void enableEventThread(boolean enable)
Sets whether to use the event processing thread.

Default: enabled.

Throws:
java.lang.IllegalStateException - if there is suspended thread and use is false.

isEventThreadEnabled

public boolean isEventThreadEnabled()
Returns whether to use the event processing thread.


isDisableBehindModalEnabled

public boolean isDisableBehindModalEnabled()
Returns whether to disable the components that don't belong to the active modal window.

Default: true.

Since:
2.4.1

enableDisableBehindModal

public void enableDisableBehindModal(boolean enable)
Sets whether to disable the components that don't belong to the active modal window.

Default: true.

Since:
2.4.1

getMonitor

public Monitor getMonitor()
Returns the monitor for this application, or null if not set.


setMonitor

public Monitor setMonitor(Monitor monitor)
Sets the monitor for this application, or null to disable it.

Default: null.

There is at most one monitor for each Web application. The previous monitor will be replaced when this method is called.

In addition to call this method, you could specify a monitor in zk.xml

Parameters:
monitor - the performance meter. If null, the meter function is disabled.
Returns:
the previous monitor, or null if not available.

getPerformanceMeter

public PerformanceMeter getPerformanceMeter()
Returns the performance meter for this application, or null if not set.

Since:
3.0.0

setPerformanceMeter

public PerformanceMeter setPerformanceMeter(PerformanceMeter meter)
Sets the performance meter for this application, or null to disable it.

Default: null.

There is at most one performance meter for each Web application. The previous meter will be replaced when this method is called.

In addition to call this method, you could specify a performance meter in zk.xml

Parameters:
meter - the performance meter. If null, the meter function is disabled.
Returns:
the previous performance meter, or null if not available.
Since:
3.0.0

getResponseCharset

public java.lang.String getResponseCharset()
Returns the charset used to generate the HTTP response or null to use the container's default. It is currently used by DHtmlLayoutServlet,

Default: UTF-8.


setResponseCharset

public void setResponseCharset(java.lang.String charset)
Sets the charset used to generate HTTP response. It is currently used by DHtmlLayoutServlet,

Parameters:
charset - the charset to use. If null or empty, the container's default is used.

getPreference

public java.lang.String getPreference(java.lang.String name,
                                      java.lang.String defaultValue)
Returns the value of the preference defined in zk.xml, or by setPreference(java.lang.String, java.lang.String).

Preference is application specific. You can specify whatever you want as you specifying context-param for a Web application.

Parameters:
defaultValue - the default value that is used if the specified preference is not found.

setPreference

public void setPreference(java.lang.String name,
                          java.lang.String value)
Sets the value of the preference.


getPreferenceNames

public java.util.Set getPreferenceNames()
Returns a readonly set of all preference names.


addRichlet

public java.lang.Object addRichlet(java.lang.String name,
                                   java.lang.Class richletClass,
                                   java.util.Map params)
Adds the definition of a richlet.

Parameters:
name - the richlet name
params - the initial parameters, or null if no initial parameter at all. Once called, the caller cannot access params any more.
Returns:
the previous richlet class or class-name with the specified name, or null if no previous richlet.

addRichlet

public java.lang.Object addRichlet(java.lang.String name,
                                   java.lang.String richletClassName,
                                   java.util.Map params)
Adds the definition of a richlet.

Parameters:
name - the richlet name
richletClassName - the class name. The class will be loaded only when the richlet is loaded.
params - the initial parameters, or null if no initial parameter at all. Once called, the caller cannot access params any more.
Returns:
the previous richlet class or class-name with the specified name, or null if no previous richlet.

addRichletMapping

public void addRichletMapping(java.lang.String name,
                              java.lang.String path)
Adds a richlet mapping.

Parameters:
name - the name of the richlet.
path - the URL pattern. It must start with '/' and may end with '/*'.
Throws:
UiException - if the richlet is not defined yet. See addRichlet(java.lang.String, java.lang.Class, java.util.Map).
Since:
2.4.0

getRichlet

public Richlet getRichlet(java.lang.String name)
Returns an instance of richlet of the specified name, or null if not found.


getRichletByPath

public Richlet getRichletByPath(java.lang.String path)
Returns an instance of richlet for the specified path, or null if not found.


detroyRichlets

public void detroyRichlets()
Destroyes all richlets.


setKeepDesktopAcrossVisits

public void setKeepDesktopAcrossVisits(boolean keep)
Specifies whether to keep the desktops across visits. If false, the desktops are removed when an user reloads an URL or browses to another URL.

Default: false.


isKeepDesktopAcrossVisits

public boolean isKeepDesktopAcrossVisits()
Returns whether to keep the desktops across visits. If false, the desktops are removed when an user reloads an URL or browses to another URL.


setTimerKeepAlive

public void setTimerKeepAlive(boolean alive)
Specifies whether to keep the session alive, when receiving the onTimer event.

Default: false.

A session is expired (and then invalidated), if it didn't receive any client request in the specified timeout interval (getSessionMaxInactiveInterval()). By setting this option to true, the session timeout will be reset when onTimer is received (just like any other event).

Note: if true and the timer is shorter than the session timeout (getSessionMaxInactiveInterval()), the session is never expired.

Parameters:
alive - whether to keep the session alive when receiving onTimer
Since:
3.0.0

isTimerKeepAlive

public boolean isTimerKeepAlive()
Returns whether to keep the session alive, when receiving the onTimer event. In other words, it returns whether to reset the session timeout counter when receiving onTimer, just like any other events.

Since:
3.0.0

setExpressionFactoryClass

public void setExpressionFactoryClass(java.lang.Class expfcls)
Sets the implementation of the expression factory that shall be used by the whole system.

Default: null -- it means the org.zkoss.xel.el.ELFactory class (it requires zcommons-el.jar).

Note: you can only specify an implementation that is compatible with JSP EL here, since ZK's builtin pages depend on it. However, you can use any factory you like in an individual page, as long as all expressions in the page follow the syntax of the evaluator you are using.

Parameters:
expfcls - the implemtation class, or null to use the default. Note: expfcls must implement ExpressionFactory.
Since:
3.0.0

getExpressionFactoryClass

public java.lang.Class getExpressionFactoryClass()
Returns the implementation of the expression factory that is used by the whole system, or null if the sytem default is used.

Since:
3.0.0
See Also:
setExpressionFactoryClass(java.lang.Class)

beforeSendEvent

public Event beforeSendEvent(Event event)
Invokes EventInterceptor.beforeSendEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.

Used only internally.

Since:
3.0.0

beforePostEvent

public Event beforePostEvent(Event event)
Invokes EventInterceptor.beforePostEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.

Used only internally.

Since:
3.0.0

beforeProcessEvent

public Event beforeProcessEvent(Event event)
Invokes EventInterceptor.beforeProcessEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.

Used only internally.

Since:
3.0.0

afterProcessEvent

public void afterProcessEvent(Event event)
Invokes EventInterceptor.afterProcessEvent(org.zkoss.zk.ui.event.Event) registered by addListener(java.lang.Class) with a class implementing EventInterceptor.

Used only internally.

Since:
3.0.0

addErrorPage

public void addErrorPage(java.lang.Class type,
                         java.lang.String location)
Deprecated. As of release 2.4.1, replaced by addErrorPage(String, Class, String)


addErrorPage

public java.lang.String addErrorPage(java.lang.String deviceType,
                                     java.lang.Class type,
                                     java.lang.String location)
Adds an error page.

Parameters:
deviceType - the device type: ajax or mil
type - what type of errors the error page is associated with.
location - where is the error page.
Returns:
the previous location of the same error, or null if not defined yet.
Since:
2.4.1

getErrorPage

public java.lang.String getErrorPage(java.lang.Throwable error)
Deprecated. As of release 2.4.1, replaced by getErrorPage(String, Throwable).


getErrorPage

public java.lang.String getErrorPage(java.lang.String deviceType,
                                     java.lang.Throwable error)
Returns the error page that matches the specified error, or null if not found.

Parameters:
deviceType - the device type: ajax or mil
error - the exception being thrown
Since:
2.4.1


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.