Class 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientPackage(String pkg) Adds a client (JavaScript) package that is provided by this server.voidAdds client data attribute handlervoidSpecifies what theme URI to be disabled.addErrorPage(String deviceType, Class<?> type, String location) Adds an error page.voidaddLabelLocation(String location) Adds the location of a properties file for i18n labels.voidaddListener(Class<?> klass) Adds a listener class.Adds the definition of a richlet.Adds the definition of a richlet.addRichlet(String name, Richlet richlet) Adds the richlet.voidaddRichletMapping(String name, String path) Adds a richlet mapping.voidaddThemeURI(String uri) Adds an CSS resource that will be generated for each ZUML desktop.voidaddThemeURIHandler(ThemeURIHandler themeURIHandler) Add aThemeURIHandler.voidafterComponentAttached(Component comp, Page page) InvokesUiLifeCycle.afterComponentAttached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page)when a component is attached to a page.voidafterComponentDetached(Component comp, Page prevpage) InvokesUiLifeCycle.afterComponentDetached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page)when a component is detached from a page.voidafterComponentMoved(Component parent, Component child, Component prevparent) InvokesUiLifeCycle.afterComponentMoved(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)when a component is moved (a.k.a., page changed).voidafterPageAttached(Page page, Desktop desktop) InvokesUiLifeCycle.afterPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Desktop)when a compnent's parent is changed.voidafterPageDetached(Page page, Desktop prevdesktop) InvokesUiLifeCycle.afterPageDetached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Desktop)when a compnent's parent is changed.voidafterProcessEvent(Event event) InvokesEventInterceptor.afterProcessEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.voidafterShadowAttached(ShadowElement shadow, Component host) InvokesUiLifeCycle.afterShadowAttached(ShadowElement, Component)when a shadow is attached to a host.voidafterShadowDetached(ShadowElement shadow, Component prevhost) InvokesUiLifeCycle.afterShadowDetached(ShadowElement, Component)when a shadow is detached from a host.beforePostEvent(Event event) InvokesEventInterceptor.beforePostEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.beforeProcessEvent(Event event) InvokesEventInterceptor.beforeProcessEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.beforeSendEvent(Event event) InvokesEventInterceptor.beforeSendEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.voidDestroys all richlets.voidenableEventThread(boolean enable) Deprecated.as of release 10.0.0.voidenableHistoryState(boolean enable) Sets whether history state handle is enabled.voidenableSourceMap(boolean enable) Sets whether source map is enabled.voidenableZScript(boolean enable) Sets whether zscript is allowed.getAttribute(String name) Returns the value of an application-specific attribute, or null if not found.Returns a map of application-specific attributes.Class<?>Returns the class used to decode AU requests, or null if the default shall be used.intReturns the timeout, in milliseconds, for re-sending the AU request when the server's service unavailable or timeout.Returns binder annotationsReturns binder init attribute namegetClientErrorReload(String deviceType, int errCode, String connType) Returns the URI that is associated with the specified error code, or null if no URI is associated.Object[][]getClientErrorReloads(String deviceType, String connType) Returns an array of pairs of the error code and URI info of the specified device and connection (never null).String[]Returns a readonly list of the names of the client pages that are provided by this serverComposer<?>getComposer(Page page) Returns the system-level composer or null if none is registered.Returns the developer-defined policy used to override the default CSP rules, or null if not specified.Returns the CSP provider responsible for generating the CSP header and managing nonce, or null if not available.Returns the URI destination for CSP violation reports, or null if not specified.Returns all of the client data attribute handlersClass<?>Returns the class used to provide the desktop cache, or null if default is used.intReturns the time, in seconds, between client requests before ZK will invalidate the desktop.Returns the desktop recycle for this application, or null if not set.Returns a set of the theme URIs that are disabled (never null).getErrorPage(String deviceType, Throwable error) Returns the error page that matches the specified error, or null if not found.intReturns the time, in seconds, to show a warning message if an event has been processinged longer than it.Returns the execution monitor for this application, or null if not set.Class<? extends org.zkoss.xel.ExpressionFactory>Returns the implementation of the expression factory that is used by the whole system, or null if the system default is used.Class<?>Returns the class used to handle the failover mechanism, or null if no custom failover mechanism.Class<?>Returns the class used to create a file item for fileupload, or null if the default shall be used.Returns the directory in which uploaded files will be stored, if stored on disk.intReturns the threshold at which a temporary file is created as a buffer, in kilobytes, or a negative value which implies default setting.Class<?>Returns the class used to generate UUID/ID for desktop, page and components, or null if the default shall be used.Returns init crash script, if null, use default, see crashmsg.jsintReturns init crash timeout, if -1, use default, which is 60 secReturns a readonly list of the system-level initiators.String[]Returns an array of the locations of properties files registered byaddLabelLocation(java.lang.String).intReturns the maximal allowed time to process events, in milliseconds.intReturns the maximal allowed number of the spare pool for queuing event processing threads (per Web application).intReturns the maximal allowed number of suspended event processing threads (per Web application).intReturns the maximal allowed upload size, in kilobytes, or a negative value if no limit.Returns the monitor for this application, or null if not set.Returns a readonly list of the system-level NamespaceParsers.Returns the performance meter for this application, or null if not set.getPreference(String name, String defaultValue) Returns the value of the preference defined in zk.xml, or bysetPreference(java.lang.String, java.lang.String).Returns a readonly set of all preference names.intReturns the time, in milliseconds, before ZK Client Engine shows a dialog to prompt users that the request is in processing.Returns a readonly list of the system-level properties renders.Returns the charset used to generate the HTTP response or null to use the container's default.getRichlet(String name) Returns an instance of richlet of the specified name, or null if not found.getRichletByPath(String path) Returns an instance of richlet for the specified path, or null if not found.Returns a readonly list of the system-level SEO renderer.Class<?>Returns the class used to store ZK sessions, or null if the default shall be used.intReturns the maximal allowed number of desktop per session.intReturns the time, in seconds, between client requests before ZK will invalidate the session.intReturns the maximal allowed number of concurrent server-pushes per session.intReturns the maximal allowed number of concurrent requests per session.Returns the theme provider for the current execution, or null if not available.Returns a list ofThemeURIHandler.String[]Returns a readonly list of the URI of the CSS resources that will be generated for each ZUML desktop (never null).getTimeoutMessage(String deviceType) Returns the timeout message for this device, or null if the default message is preferred.getTimeoutURI(String deviceType) Returns the timeout URI for this device.intReturns the time, in milliseconds, before ZK Client Engine shows the tooltip when a user moves the mouse over particular UI components.Class<?>Returns the class used to handle UI loading and updates, or null if default is used.Class<?>Returns the class used to instantiate desktops, pages and components, or null if default is used.Returns the charset used to encode the uploaded text file (never null).Returns the finder that is used to decide the character set for the uploaded text file(s), or null if not available.Returns the Web application that this configuration belongs to, or null if it is not associated yet.Class<?>Returns the class used to represent this Web application, or null if default is used.Class<?>Returns the class used to instantiate an instance representing this Web application, or null if default is used.booleanhasCallBack(String name) Returns if a callback functionCallback.call(Object data)is registered.voidInitializes the given page with the variable resolvers registered byaddListener(java.lang.Class<?>).voidinvokeCallback(String name, Object data) Invokes a callback functionCallback.call(Object data)voidinvokeDesktopCleanups(Desktop desktop) InvokesDesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeDesktopInits(Desktop desktop, Object request) InvokesDesktopInit.init(org.zkoss.zk.ui.Desktop, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeEventThreadCompletes(List<EventThreadCleanup> cleanups, Component comp, Event evt, List<Throwable> errs, boolean silent) booleaninvokeEventThreadInits(List<EventThreadInit> inits, Component comp, Event evt) InvokesEventThreadInit.init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each instance returned bynewEventThreadInits(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).voidinvokeEventThreadResumeAborts(Component comp, Event evt) InvokesEventThreadResume.abortResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeEventThreadResumes(List<EventThreadResume> resumes, Component comp, Event evt) voidinvokeEventThreadSuspends(List<EventThreadSuspend> suspends, Component comp, Event evt) InvokesEventThreadSuspend.afterSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeExecutionCleanups(Execution exec, Execution parent, List<Throwable> errs) InvokesExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List<java.lang.Throwable>)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeExecutionInits(Execution exec, Execution parent) InvokesExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeRequestInterceptors(Session sess, Object request, Object response) InvokesRequestInterceptor.request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeSessionCleanups(Session sess) InvokesSessionCleanup.cleanup(org.zkoss.zk.ui.Session)for each relevant listener registered byaddListener(java.lang.Class<?>).voidinvokeSessionInits(Session sess, Object request) InvokesSessionInit.init(org.zkoss.zk.ui.Session, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).voidInvokesURIInterceptor.request(java.lang.String)for each relevant listener registered byaddListener(java.lang.Class<?>).voidInvokesWebAppCleanup.cleanup(org.zkoss.zk.ui.WebApp)for each relevant listener registered byaddListener(java.lang.Class<?>).voidInvokesWebAppInit.init(org.zkoss.zk.ui.WebApp)for each relevant listener registered byaddListener(java.lang.Class<?>).booleanisAutomaticTimeout(String deviceType) Returns whether to automatically trigger the timeout at the client.booleanReturns whether this Web application can be crawled by search engines.booleanReturns whether this Web application enables Content Security Policy (CSP).booleanReturns whether CSP is enforced in report-only mode.booleanReturns whether this Web application enables nonce-based strict CSP mode.booleanReturns whether to use customThemeProvider.booleanReturns whether to use customThemeRegistry.booleanReturns whether to use customThemeResolver.booleanReturns whether to debug JavaScript files.booleanDeprecated.as of release 10.0.0.booleanReturns whether history state handle is enabled.booleanReturns whether to keep the desktops across visits.booleanReturns whether to send client errors to the server for logging the page url where the error occurred and its stack trace.booleanReturns whether source map is enabled.booleanReturns whether to keep the session alive, when receiving the onTimer event.booleanReturns whether zscript is allowed.newEventThreadCleanups(Component comp, Event evt, List<Throwable> errs, boolean silent) InvokesEventThreadCleanup.cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)for each relevant listener registered byaddListener(java.lang.Class<?>).newEventThreadInits(Component comp, Event evt) Constructs a list ofEventThreadInitinstances and invokesEventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).newEventThreadResumes(Component comp, Event evt) Constructs a list ofEventThreadResumeinstances and invokesEventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).newEventThreadSuspends(Component comp, Event evt, Object obj) Constructs a list ofEventThreadSuspendinstances and invokesEventThreadSuspend.beforeSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).voidregisterCallBack(String name, Callback callback) Register a callback functionCallback.call(Object data)removeAttribute(String name) Removes the value of an application-specific attribute.removeClientErrorReload(String deviceType, int errCode, String connType) Removes the URI to redirect to, when ZK Client Engine receives an error.voidremoveListener(Class<?> klass) Removes a listener class.removeRichlet(String name) Removes the richlet and associated richlet mappings.setAttribute(String name, Object value) Returns the value of an application-specific attribute.voidsetAuDecoderClass(Class<?> cls) Sets the class that is used to decode AU requests, or null to use the default.booleansetAutomaticTimeout(String deviceType, boolean auto) Sets whether to automatically trigger the timeout at the client.voidsetAutoResendTimeout(int minisecs) Specifies the timeout, in milliseconds, to re-send the AU request when the server's service unavailable or timeout.voidsetBinderAnnotations(Set<String> binderAnnotations) Set binder annotationsvoidsetBinderInitAttribute(String binderInitAttribute) Set binder init attribute namesetClientErrorReload(String deviceType, int errCode, String uri, String connType) Sets the URI to redirect to, when ZK Client Engine receives an error.voidsetCrawlable(boolean crawlable) Sets whether this Web application is crawlable.voidsetCspEnabled(boolean cspEnabled) Sets whether CSP is enabled.voidsetCspPolicy(String policy) Sets the developer-defined policy used to override the default CSP rules.voidsetCspProvider(CspProvider cspProvider) Sets the CSP provider.voidsetCspReportOnly(boolean cspReportOnly) Sets whether to enforce CSP in report-only mode.voidsetCspReportURI(String cspReportURI) Sets the URI destination for CSP violation reports.voidsetCspStrictDynamicEnabled(boolean cspStrictDynamicEnabled) Sets whether nonce-based strict CSP mode is enabled.voidsetCustomThemeProvider(boolean customThemeProvider) Sets whether to use customThemeProvider.voidsetCustomThemeRegistry(boolean customThemeRegistry) Sets whether to use customThemeRegistry.voidsetCustomThemeResolver(boolean customThemeResolver) Sets whether to use customThemeResolver.voidsetDebugJS(boolean debug) Sets whether to debug JavaScript files.voidsetDesktopCacheProviderClass(Class<?> cls) Sets the class used to provide the desktop cache, or null to use the default.voidsetDesktopMaxInactiveInterval(int secs) Specifies the time, in seconds, between client requests before ZK will invalidate the desktop.setDesktopRecycle(DesktopRecycle dtRecycle) Sets the desktop recycler for this application, or null to disable it.voidsetEventTimeWarning(int secs) Set the time, in seconds, to show a warning message if an event has been processinged longer than it.setExecutionMonitor(ExecutionMonitor monitor) Sets the execution monitor for this application, or null to disable it.voidsetExpressionFactoryClass(Class<? extends org.zkoss.xel.ExpressionFactory> expfcls) Sets the implementation of the expression factory that shall be used by the whole system.voidsetFailoverManagerClass(Class<?> cls) Sets the class used to handle the failover mechanism, or null if no custom failover mechanism.voidsetFileItemFactoryClass(Class<?> cls) Sets the class that is used to create a file item for fileupload, or null to use the default.voidsetFileRepository(String directory) Sets the directory in which uploaded files will be stored, if stored on disk.voidsetFileSizeThreshold(int sz) Specifies the threshold at which a temporary file is created as a buffer, in kilobytes.voidsetIdGeneratorClass(Class<?> cls) Sets the class that is used to generate UUID/ID of desktop, page and components, or null to use the default.voidsetInitCrashScript(String script) Sets user customized init crash scriptvoidsetInitCrashTimeout(int timeout) Sets user customized init crash timeoutvoidsetKeepDesktopAcrossVisits(boolean keep) Specifies whether to keep the desktops across visits.voidsetMaxProcessTime(int time) Specifies the maximal allowed time to process events, in milliseconds.voidsetMaxSpareThreads(int max) Specifies the maximal allowed number of the spare pool for queuing the event processing threads (per Web application).voidsetMaxSuspendedThreads(int max) Specifies the maximal allowed number of suspended event processing threads (per Web application).voidsetMaxUploadSize(int sz) Specifies the maximal allowed upload size, in kilobytes.setMonitor(Monitor monitor) Sets the monitor for this application, or null to disable it.Sets the performance meter for this application, or null to disable it.voidsetPreference(String name, String value) Sets the value of the preference.voidsetProcessingPromptDelay(int minisecs) Specifies the time, in milliseconds, before ZK Client Engine shows a dialog to prompt users that the request is in processing.voidsetResponseCharset(String charset) Sets the charset used to generate HTTP response.voidsetSendClientErrors(boolean send) Sets whether to send client errors to the server for logging the page url where the error occurred and its stack trace.voidsetSessionCacheClass(Class<?> cls) Sets the class that is used to store ZK sessions, or null to use the default.voidsetSessionMaxDesktops(int max) Specifies the maximal allowed number of desktop per session.voidsetSessionMaxInactiveInterval(int secs) Specifies the time, in seconds, between client requests before ZK will invalidate the session.voidsetSessionMaxPushes(int max) Specifies the maximal allowed number of concurrent server-pushes per session.voidsetSessionMaxRequests(int max) Specifies the maximal allowed number of concurrent requests per session.voidsetThemeProvider(ThemeProvider provider) Sets the theme provider for the current execution, or null if not available.setTimeoutMessage(String deviceType, String message) Sets the timeout message for this device, or null if the default message is preferred.setTimeoutURI(String deviceType, String timeoutURI, int type) Sets the timeout URI.voidsetTimerKeepAlive(boolean alive) Specifies whether to keep the session alive, when receiving the onTimer event.voidsetTooltipDelay(int minisecs) Specifies the time, in milliseconds, before ZK Client Engine shows the tooltip when a user moves the mouse over particular UI components.voidsetUiEngineClass(Class<?> cls) Sets the class used to handle UI loading and updates, or null to use the default.voidsetUiFactoryClass(Class<?> cls) Sets the class used to instantiate desktops, pages and components, or null to use the default.voidsetUploadCharset(String charset) Sets the charset used to encode the upload text file.voidsetUploadCharsetFinder(CharsetFinder finder) Sets the finder that is used to decide the character set for the uploaded text file(s), or null if not available.voidAssociates it with a web application.voidsetWebAppClass(Class<?> cls) Sets the class used to represent this Web application, or null to use the default.voidsetWebAppFactoryClass(Class<?> cls) Sets the class used to instantiate an instance representing this Web application, or null to use the default.voidunregisterCallBack(String name) Unregister a callback functionCallback.call(Object data)
-
Constructor Details
-
Configuration
public Configuration()Constructor.
-
-
Method Details
-
getWebApp
Returns the Web application that this configuration belongs to, or null if it is not associated yet. -
setWebApp
Associates it with a web application. -
addListener
Adds a listener class.Notice that there is only one listener allowed for the following classes:
Monitor,PerformanceMeter, andDesktopRecycle. On the other hand, any number listeners are allowed for other classes.Notice that if the listener implements
Composer, it can also implementComposerExtand/orFullComposerto have more detailed control. However, ComposerExt and FullComposer are meaningless to richlets. In additions, an independent composer is instantiated for each page so there is synchronization required.By default, a listener is instantiated when required, and dropped after invoked. In other words, a new instance will be instantiated in the next invocation. It means you don't have to worry the threading,
However, for better performance, the following listeners will be instantiated in
addListener(java.lang.Class<?>), and then used repeatedly. It means it has to be thread safe. These listeners includeURIInterceptor,RequestInterceptor,EventInterceptor,UiLifeCycle, andPropertiesRenderer.- Parameters:
klass- the listener class must implement at least one ofMonitor,PerformanceMeter,EventThreadInit,EventThreadCleanup,EventThreadSuspend,EventThreadResume,WebAppInit,WebAppCleanup,SessionInit,SessionCleanup,DesktopInit,DesktopCleanup,ExecutionInit,ExecutionCleanup,Composer,Initiator(since 5.0.7),SEORenderer(since 5.0.7),PropertiesRenderer(since 5.0.7),VariableResolver,URIInterceptor,RequestInterceptor,UiLifeCycle,DesktopRecycle, and/orEventInterceptorinterfaces.- Throws:
Exception- See Also:
-
removeListener
Removes a listener class.- See Also:
-
newEventThreadInits
Constructs a list ofEventThreadInitinstances and invokesEventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally (by
UiEnginebefore starting an event processing thread).- Returns:
- a list of
EventThreadInitinstances that are constructed in this method (and theirEventThreadInit.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 ifEventThreadInit.prepare(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)throws an exception
-
invokeEventThreadInits
public boolean invokeEventThreadInits(List<EventThreadInit> inits, Component comp, Event evt) throws UiException InvokesEventThreadInit.init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each instance returned bynewEventThreadInits(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event).Used only internally.
- Parameters:
inits- a list ofEventThreadInitinstances returned fromnewEventThreadInits(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 targetingevt- 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 ifEventThreadInit.init(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)throws an exception
-
newEventThreadCleanups
public List<EventThreadCleanup> newEventThreadCleanups(Component comp, Event evt, List<Throwable> errs, boolean silent) InvokesEventThreadCleanup.cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
EventThreadCleanupis constructed first, and then invokeEventThreadCleanup.cleanup(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>).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 targetingevt- the event to processerrs- a list of exceptions (java.lang.Throwable) if any exception occurred before this method is called, or null if no exception 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.silent- whether not to log the exception- Returns:
- a list of
EventThreadCleanup, or null - Since:
- 3.6.3
-
invokeEventThreadCompletes
public void invokeEventThreadCompletes(List<EventThreadCleanup> cleanups, Component comp, Event evt, List<Throwable> errs, boolean silent) InvokeEventThreadCleanup.complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each instance returned bynewEventThreadCleanups(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>, boolean).Used only internally.
It never throws an exception but logs and adds it to the errs argument, if not null.
- Parameters:
cleanups- a list ofEventThreadCleanupinstances returned fromnewEventThreadCleanups(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.util.List<java.lang.Throwable>, boolean), or null if no instance at all.errs- used to hold the exceptions that are thrown byEventThreadCleanup.complete(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event). If null, all exceptions are ignored (but logged).silent- whether not to log the exception- Since:
- 3.6.3
-
newEventThreadSuspends
Constructs a list ofEventThreadSuspendinstances and invokesEventThreadSuspend.beforeSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
Note: caller shall execute in the event processing thread.
- Parameters:
comp- the component which the event is targetingevt- the event to processobj- which object thatExecutions.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(List<EventThreadSuspend> suspends, Component comp, Event evt) throws UiException InvokesEventThreadSuspend.afterSuspend(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>). UnlikeinvokeEventThreadSuspends(java.util.List<org.zkoss.zk.ui.event.EventThreadSuspend>, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), caller shall execute in the main thread (a.k.a., servlet thread).Used only internally.
Unlike
invokeEventThreadSuspends(java.util.List<org.zkoss.zk.ui.event.EventThreadSuspend>, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event), exceptions are logged and ignored.- Parameters:
suspends- a list ofEventThreadSuspendinstances returned fromnewEventThreadSuspends(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 targetingevt- the event to process- Throws:
UiException
-
newEventThreadResumes
Constructs a list ofEventThreadResumeinstances and invokesEventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally (by
UiEnginewhen 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 targetingevt- the event to process- Returns:
- a list of
EventThreadResumeinstances that are constructed in this method (and theirEventThreadResume.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 ifEventThreadResume.beforeResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)throws an exception
-
invokeEventThreadResumes
public void invokeEventThreadResumes(List<EventThreadResume> resumes, Component comp, Event evt) throws UiException InvokesEventThreadResume.afterResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each instance returned bynewEventThreadResumes(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 ofEventThreadResumeinstances returned fromnewEventThreadResumes(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 targetingevt- the event to process If null, all exceptions are ignored (but logged)- Throws:
UiException
-
invokeEventThreadResumeAborts
InvokesEventThreadResume.abortResume(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.event.Event)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
EventThreadResumeis constructed first, and then invokeEventThreadResume.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 targetingevt- the event to process
-
invokeWebAppInits
InvokesWebAppInit.init(org.zkoss.zk.ui.WebApp)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
WebAppInitis constructed first, and then invokeWebAppInit.init(org.zkoss.zk.ui.WebApp).- Throws:
UiException- to prevent a webapp from being created
-
invokeWebAppCleanups
public void invokeWebAppCleanups()InvokesWebAppCleanup.cleanup(org.zkoss.zk.ui.WebApp)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
WebAppCleanupis constructed first, and then invokeWebAppCleanup.cleanup(org.zkoss.zk.ui.WebApp).It never throws an exception.
-
invokeSessionInits
InvokesSessionInit.init(org.zkoss.zk.ui.Session, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
SessionInitis constructed first, and then invokeSessionInit.init(org.zkoss.zk.ui.Session, java.lang.Object).- Parameters:
sess- the session that is createdrequest- the original request. If HTTP, it is jakarta.servlet.http.HttlServletRequest.- Throws:
UiException- to prevent a session from being created- Since:
- 3.0.1
-
invokeSessionCleanups
InvokesSessionCleanup.cleanup(org.zkoss.zk.ui.Session)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
SessionCleanupis constructed first, and then invokeSessionCleanup.cleanup(org.zkoss.zk.ui.Session).It never throws an exception.
- Parameters:
sess- the session that is being destroyed
-
invokeDesktopInits
InvokesDesktopInit.init(org.zkoss.zk.ui.Desktop, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
DesktopInitis constructed first, and then invokeDesktopInit.init(org.zkoss.zk.ui.Desktop, java.lang.Object).- Parameters:
desktop- the desktop that is createdrequest- the original request. If HTTP, it is jakarta.servlet.http.HttlServletRequest.- Throws:
UiException- to prevent a desktop from being created- Since:
- 3.0.1
-
invokeDesktopCleanups
InvokesDesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
DesktopCleanupis constructed first, and then invokeDesktopCleanup.cleanup(org.zkoss.zk.ui.Desktop).It never throws an exception.
- Parameters:
desktop- the desktop that is being destroyed
-
invokeExecutionInits
InvokesExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
ExecutionInitis constructed first, and then invokeExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution).- Parameters:
exec- the execution that is createdparent- the previous execution, or null if no previous at all- Throws:
UiException- to prevent an execution from being created
-
invokeExecutionCleanups
InvokesExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List<java.lang.Throwable>)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
An instance of
ExecutionCleanupis constructed first, and then invokeExecutionCleanup.cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List<java.lang.Throwable>).It never throws an exception but logs and adds it to the errs argument, if not null.
- Parameters:
exec- the execution that is being destroyedparent- the previous execution, or null if no previous at allerrs- a list of exceptions (java.lang.Throwable) if any exception occurred before this method is called, or null if no exception 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
InvokesURIInterceptor.request(java.lang.String)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
If any of them throws an exception, the exception is propagated to the caller.
- Throws:
UiException- if it is rejected by the interceptor. UseThrowable.getCause()to retrieve the cause.
-
invokeRequestInterceptors
InvokesRequestInterceptor.request(org.zkoss.zk.ui.Session, java.lang.Object, java.lang.Object)for each relevant listener registered byaddListener(java.lang.Class<?>).Used only internally.
If any of them throws an exception, the exception is propagated to the caller.
- Throws:
UiException- if it is rejected by the interceptor. UseThrowable.getCause()to retrieve the cause.
-
addLabelLocation
Adds the location of a properties file for i18n labels.Default: none (/WEB-INF/zk-label.properties is assumed).
Notice that this method has no effect after the web server has been started. Thus, it is suggested to use the label-location element in zk.xml instead.
- Since:
- 5.0.7
-
getLabelLocations
Returns an array of the locations of properties files registered byaddLabelLocation(java.lang.String).- Since:
- 5.0.7
-
getComposer
Returns the system-level composer or null if none is registered. To register a system-level composer, useaddListener(java.lang.Class<?>).Notice that any number of composers can be registered, and a single composer is returned to represent them all.
- Throws:
Exception- Since:
- 5.0.1
-
getInitiators
Returns a readonly list of the system-level initiators. It is empty if none is registered. To register a system-level initiator, useaddListener(java.lang.Class<?>).- Since:
- 5.0.7
-
getNamespaceParsers
Returns a readonly list of the system-level NamespaceParsers. It is empty if none is registered. To register a system-level NamespaceParsers, useaddListener(java.lang.Class<?>).- Since:
- 7.0.3
-
getSEORenderers
Returns a readonly list of the system-level SEO renderer. It is empty if none is registered. To register a system-level SEO renderers, useaddListener(java.lang.Class<?>).Notice that, once registered, an instance is instantiated before invoking
SEORenderer.render(org.zkoss.zk.ui.Page, java.io.Writer).- Since:
- 5.0.7
-
init
Initializes the given page with the variable resolvers registered byaddListener(java.lang.Class<?>). It must be called before accessing a page (actually inPageCtrl.preInit()).- Since:
- 5.0.4
-
getPropertiesRenderers
Returns a readonly list of the system-level properties renders. It is empty if none is registered. To register a system-level properties renders, useaddListener(java.lang.Class<?>).Notice that, once registered, it is instantiated immediately, and the same instance is shared for rendering the properties of every component.
- Since:
- 5.0.7
-
afterComponentAttached
InvokesUiLifeCycle.afterComponentAttached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page)when a component is attached to a page.- Since:
- 3.0.6
-
afterComponentDetached
InvokesUiLifeCycle.afterComponentDetached(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Page)when a component is detached from a page.- Since:
- 3.0.6
-
invokeCallback
Invokes a callback functionCallback.call(Object data)- Parameters:
name- the name of the callback function.data- the parameter for the callback function.- Since:
- 8.5.2
-
registerCallBack
Register a callback functionCallback.call(Object data)- Parameters:
name- the name of the callback function.callback- the callback function to register into Configuration class.- Since:
- 8.5.2
-
unregisterCallBack
Unregister a callback functionCallback.call(Object data)- Parameters:
name- the name of the callback function.- Since:
- 8.5.2
-
hasCallBack
Returns if a callback functionCallback.call(Object data)is registered.- Parameters:
name- the name of the callback function.- Returns:
- If a callback function is registered.
- Since:
- 8.5.2
-
afterShadowAttached
InvokesUiLifeCycle.afterShadowAttached(ShadowElement, Component)when a shadow is attached to a host.- Since:
- 8.0.0
-
afterShadowDetached
InvokesUiLifeCycle.afterShadowDetached(ShadowElement, Component)when a shadow is detached from a host.- Since:
- 8.0.0
-
afterComponentMoved
InvokesUiLifeCycle.afterComponentMoved(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)when a component is moved (a.k.a., page changed).- Since:
- 3.0.6
-
afterPageAttached
InvokesUiLifeCycle.afterPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Desktop)when a compnent's parent is changed.- Since:
- 3.0.6
-
afterPageDetached
InvokesUiLifeCycle.afterPageDetached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Desktop)when a compnent's parent is changed.- Since:
- 3.0.6
-
addThemeURI
Adds an CSS resource that will be generated for each ZUML desktop.Note: if
ThemeProvideris specified (setThemeProvider(org.zkoss.zk.ui.util.ThemeProvider)), the final theme URIs generated depend onThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List<java.lang.Object>). -
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
Specifies what theme URI to be disabled.Note: if
ThemeProvideris used (setThemeProvider(org.zkoss.zk.ui.util.ThemeProvider)), the URIs of the theme depend onThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List<java.lang.Object>).- Parameters:
uri- the theme URI to disable- Since:
- 3.0.0
-
getDisabledThemeURIs
Returns a set of the theme URIs that are disabled (never null).- Since:
- 3.0.0
- See Also:
-
addThemeURIHandler
Add aThemeURIHandler.Note: if
ThemeProvideris specified (setThemeProvider(org.zkoss.zk.ui.util.ThemeProvider)), the final generated theme URIs depend onThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List<java.lang.Object>).- Since:
- 9.6.0
-
getThemeURIHandlers
Returns a list ofThemeURIHandler.- Since:
- 9.6.0
-
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:
-
setThemeProvider
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:
-
setUiEngineClass
Sets the class used to handle UI loading and updates, or null to use the default. It must implementUiEngine. -
getUiEngineClass
Returns the class used to handle UI loading and updates, or null if default is used. It must implementUiEngine. -
setWebAppClass
Sets the class used to represent this Web application, or null to use the default. It must implementWebAppandWebAppCtrlNote: you have to set the class before
WebAppis created. Otherwise, it won't have any effect. -
getWebAppClass
Returns the class used to represent this Web application, or null if default is used. It must implementWebAppandWebAppCtrl -
setWebAppFactoryClass
Sets the class used to instantiate an instance representing this Web application, or null to use the default.Note:
setWebAppClass(java.lang.Class<?>)has the higher priority if not null.Note: you have to set the class before
WebAppis created. Otherwise, it won't have any effect.- Parameters:
cls- the class that implementsWebAppFactory.- Since:
- 6.0.0
-
getWebAppFactoryClass
Returns the class used to instantiate an instance representing this Web application, or null if default is used. It must implementWebAppFactory.Note:
getWebAppClass()has the higher priority if not null.- Since:
- 6.0.0
-
setDesktopCacheProviderClass
Sets the class used to provide the desktop cache, or null to use the default. It must implementDesktopCacheProvider.Note: you have to set the class before
WebAppis created. Otherwise, it won't have any effect. -
getDesktopCacheProviderClass
Returns the class used to provide the desktop cache, or null if default is used. It must implementDesktopCacheProvider. -
setUiFactoryClass
-
getUiFactoryClass
Returns the class used to instantiate desktops, pages and components, or null if default is used. It must implementUiFactory, -
setFailoverManagerClass
Sets the class used to handle the failover mechanism, or null if no custom failover mechanism. It must implementFailoverManager.Note: you have to set the class before
WebAppis created. Otherwise, it won't have any effect. -
getFailoverManagerClass
Returns the class used to handle the failover mechanism, or null if no custom failover mechanism. It must implementFailoverManager. -
setIdGeneratorClass
Sets the class that is used to generate UUID/ID of desktop, page and components, or null to use the default. It must implementIdGenerator.Note: you have to set the class before
WebAppis created. Otherwise, it won't have any effect.- Since:
- 2.4.1
-
getIdGeneratorClass
Returns the class used to generate UUID/ID for desktop, page and components, or null if the default shall be used. It must implementIdGenerator- Since:
- 2.4.1
-
setSessionCacheClass
Sets the class that is used to store ZK sessions, or null to use the default. It must implementSessionCache.Note: you have to set the class before
WebAppis created. Otherwise, it won't have any effect.- Since:
- 3.0.5
-
getSessionCacheClass
Returns the class used to store ZK sessions, or null if the default shall be used. It must implementSessionCache.- Since:
- 3.0.5
-
setFileItemFactoryClass
Sets the class that is used to create a file item for fileupload, or null to use the default. It must implementDiskFileItemFactory.- Since:
- 8.0.2
-
getFileItemFactoryClass
Returns the class used to create a file item for fileupload, or null if the default shall be used. It must implementDiskFileItemFactory.- Since:
- 8.0.2
-
setAuDecoderClass
Sets the class that is used to decode AU requests, or null to use the default. It must implementAuDecoder.Note: you have to set the class before
WebAppis created. Otherwise, it won't have any effect.- Since:
- 5.0.4
-
getAuDecoderClass
Returns the class used to decode AU requests, or null if the default shall be used. It must implementAuDecoder.- Since:
- 5.0.4
-
setMaxProcessTime
public void setMaxProcessTime(int time) Specifies the maximal allowed time to process events, in milliseconds. ZK will keep processing the requests until all requests are processed, or the maximal allowed time expires.Default: 3000.
Note: since 3.0.0, this setting has no effect on AU requests. It controls only the requests from the client-polling server push.
- 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 milliseconds. 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 there is no limit.
-
getMaxUploadSize
public int getMaxUploadSize()Returns the maximal allowed upload size, in kilobytes, or a negative value if no limit. -
setFileSizeThreshold
public void setFileSizeThreshold(int sz) Specifies the threshold at which a temporary file is created as a buffer, in kilobytes.Default: 128.
- Parameters:
sz- the file size threshold A negative value implies default setting.- Since:
- 5.0.8
-
getFileSizeThreshold
public int getFileSizeThreshold()Returns the threshold at which a temporary file is created as a buffer, in kilobytes, or a negative value which implies default setting.- Since:
- 5.0.8
-
setFileRepository
Sets the directory in which uploaded files will be stored, if stored on disk.- Parameters:
directory-- Since:
- 8.0.2
-
getFileRepository
Returns the directory in which uploaded files will be stored, if stored on disk.Default: null
- Since:
- 8.0.2
-
getUploadCharset
Returns the charset used to encode the uploaded text file (never null).Default: UTF-8.
- See Also:
-
setUploadCharset
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:
-
getUploadCharsetFinder
Returns the finder that is used to decide the character set for the uploaded text file(s), or null if not available.Default: null
- Since:
- 3.0.0
- See Also:
-
setUploadCharsetFinder
Sets the finder that is used to decide the character set for the uploaded text file(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 orCharsetFinder.getCharset(java.lang.String, java.io.InputStream)returns null.- Since:
- 3.0.0
- See Also:
-
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.Notice that this timeout is used only if JVM starts GC when the memory is running low.
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 processing.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 processing. -
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 particular 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 particular UI components. -
setAutoResendTimeout
public void setAutoResendTimeout(int minisecs) Specifies the timeout, in milliseconds, to re-send the AU request when the server's service unavailable or timeout.Default: 200
- Since:
- 6.5.2
-
getAutoResendTimeout
public int getAutoResendTimeout()Returns the timeout, in milliseconds, for re-sending the AU request when the server's service unavailable or timeout.- Since:
- 6.5.2
Default: 200
-
isCrawlable
public boolean isCrawlable()Returns whether this Web application can be crawled by search engines. Notice that there is some performance loss for huge web pages.Default: false.
- Since:
- 5.0.0
-
setCrawlable
public void setCrawlable(boolean crawlable) Sets whether this Web application is crawlable. Make a Web application that allows search engines to crawl the application. Notice that there is some performance loss for huge web pages. (EE only)- Since:
- 5.0.0
-
isCspEnabled
public boolean isCspEnabled()Returns whether this Web application enables Content Security Policy (CSP). It is required for other CSP settings and applies a default policy when enabled.Default: false.
- Since:
- 10.3.0
-
setCspEnabled
public void setCspEnabled(boolean cspEnabled) Sets whether CSP is enabled.- Since:
- 10.3.0
-
isCspStrictDynamicEnabled
public boolean isCspStrictDynamicEnabled()Returns whether this Web application enables nonce-based strict CSP mode.Default: false.
- Since:
- 10.3.0
-
setCspStrictDynamicEnabled
public void setCspStrictDynamicEnabled(boolean cspStrictDynamicEnabled) Sets whether nonce-based strict CSP mode is enabled.- Since:
- 10.3.0
-
getCspPolicy
Returns the developer-defined policy used to override the default CSP rules, or null if not specified.- Returns:
- the current Csp Header Content
- Since:
- 10.3.0
-
setCspPolicy
Sets the developer-defined policy used to override the default CSP rules.- Parameters:
policy- the CSP policy to use, or null to use the default- Since:
- 10.3.0
-
isCspReportOnly
public boolean isCspReportOnly()Returns whether CSP is enforced in report-only mode.Default: false.
- Since:
- 10.3.0
-
setCspReportOnly
public void setCspReportOnly(boolean cspReportOnly) Sets whether to enforce CSP in report-only mode.- Since:
- 10.3.0
-
getCspReportURI
Returns the URI destination for CSP violation reports, or null if not specified.Default: null.
- Since:
- 10.3.0
-
setCspReportURI
Sets the URI destination for CSP violation reports.- Parameters:
cspReportURI- the URI to send CSP reports to, or null to disable reporting- Since:
- 10.3.0
-
getCspProvider
Returns the CSP provider responsible for generating the CSP header and managing nonce, or null if not available.Default: an instance of
CspProviderImpl.- Since:
- 10.3.0
-
setCspProvider
Sets the CSP provider.- Parameters:
cspProvider- the CSP provider to use, or null to use the default- Since:
- 10.3.0
-
getTimeoutURI
Returns the timeout URI for this device. It is used to show the error message if the desktop being requested is not found. It is usually caused by session timeout.Default: null (to shown an error message).
- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.- Since:
- 3.6.3
-
setTimeoutURI
Sets the timeout URI. It is used to show the error message if the desktop being requested is not found. It is usually caused by session timeout.- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.timeoutURI- the timeout URI. If empty, it means to reload the same page. If null, an error message is shown instead of redirecting to another page.type- how to handle the timeout URI. It is one ofURIInfo.SEND_REDIRECTorURIInfo.POPUP. However, it supports onlyURIInfo.SEND_REDIRECTcurrently.- Returns:
- the previous timeout URI, or null if not available.
- Since:
- 3.6.3
-
getTimeoutMessage
Returns the timeout message for this device, or null if the default message is preferred. It is used only ifgetTimeoutURI(java.lang.String)returns null.- Since:
- 5.0.5
- See Also:
-
setTimeoutMessage
Sets the timeout message for this device, or null if the default message is preferred. It is used only ifgetTimeoutURI(java.lang.String)returns null.To specify an I18N label, prefix the key with
label:. To specify the JavaScript code, prefix the code withscript:. Refer to ZK Configuration Reference for more information.- Returns:
- the previous message, if any
- Since:
- 5.0.5
-
isAutomaticTimeout
Returns whether to automatically trigger the timeout at the client. Refer tosetAutomaticTimeout(java.lang.String, boolean)for details.- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.- Since:
- 3.6.3
- See Also:
-
setAutomaticTimeout
Sets whether to automatically trigger the timeout at the client.Default: false. It means this page is redirected to the timeout URI when the use takes some action after timeout. In other words, nothing happens if the user does nothing. If it is set to true, it is redirected as soon as the timeout URI, no matter the user takes any action.
- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.- Since:
- 3.6.3
- See Also:
-
setClientErrorReload
Sets the URI to redirect to, when ZK Client Engine receives an error.- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.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 asremoveClientErrorReload(java.lang.String, int, java.lang.String)connType- the connection type: au or server-push. If null, "au" is assumed.- Returns:
- the previous URI associated with the specified error code
- Since:
- 3.6.3
-
removeClientErrorReload
Removes the URI to redirect to, when ZK Client Engine receives an error.- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.errCode- the error code.connType- the connection type: au or server-push. If null, "au" is assumed.- Returns:
- the previous URI associated with the specified error code
- Since:
- 3.6.3
-
getClientErrorReload
Returns the URI that is associated with the specified error code, or null if no URI is associated.- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.errCode- the error code.connType- the connection type: au or server-push. If null, "au" is assumed.- Since:
- 3.6.3
-
getClientErrorReloads
Returns an array of pairs of the error code and URI info of the specified device and connection (never null).Default: none (none since 3.6.0, while older version: 302, 401 and 403 are associated with an empty URI).
- Parameters:
deviceType- the device type: ajax or mil. If null, ajax is assumed.connType- the connection type: au or server-push. If null, "au" is assumed.- Returns:
- an array of pairs (two-element arrays) of the error code and URI info.
In other words, each element of the returned array is a pair of
Integer and
URIInfo. For example, [[410, new URIInfo("/login.zul")], [310, new URIInfo("/login2.zul")]]. - Since:
- 3.6.3
-
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).
-
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).
-
setSessionMaxDesktops
public void setSessionMaxDesktops(int max) Specifies the maximal allowed number of desktop per session.Default: 15.
A negative value indicates there is no limit.
- Since:
- 3.0.1
-
getSessionMaxDesktops
public int getSessionMaxDesktops()Returns the maximal allowed number of desktop per session.A negative value indicates there is no limit.
- Since:
- 3.0.1
-
setSessionMaxRequests
public void setSessionMaxRequests(int max) Specifies the maximal allowed number of concurrent requests per session.Default: 5.
A negative value indicates there is no limit, but it is not recommended due to the possibility of the DoS attacks.
- Since:
- 3.0.1
-
getSessionMaxRequests
public int getSessionMaxRequests()Returns the maximal allowed number of concurrent requests per session.A negative value indicates there is no limit, but it is not recommended due to the possibility of the DoS attacks.
- Since:
- 3.0.1
-
setSessionMaxPushes
public void setSessionMaxPushes(int max) Specifies the maximal allowed number of concurrent server-pushes per session.Default: -1 (no limitation).
- Parameters:
max- the maximal allowed number. A negative value indicates there is no limit.- Since:
- 5.0.0
-
getSessionMaxPushes
public int getSessionMaxPushes()Returns the maximal allowed number of concurrent server-pushes per session. -
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.
-
getMaxSpareThreads
public int getMaxSpareThreads()Returns the maximal allowed number of the spare pool for queuing event processing threads (per Web application).- See Also:
-
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:
-
enableEventThread
public void enableEventThread(boolean enable) Deprecated.as of release 10.0.0. (not recommended to use in production)Sets whether to use the event processing thread.Default: false (disabled).
- Throws:
IllegalStateException- if there is suspended thread and use is false.
-
isEventThreadEnabled
public boolean isEventThreadEnabled()Deprecated.as of release 10.0.0. (not recommended to use in production)Returns whether to use the event processing thread.Default: false (disabled).
-
enableZScript
public void enableZScript(boolean enable) Sets whether zscript is allowed.Default: true (enabled).
- Since:
- 6.0.0
-
isZScriptEnabled
public boolean isZScriptEnabled()Returns whether zscript is allowed.Default: true (enabled).
- Since:
- 6.0.0
-
getMonitor
Returns the monitor for this application, or null if not set. -
setMonitor
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
Returns the performance meter for this application, or null if not set.- Since:
- 3.0.0
-
setPerformanceMeter
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
-
getExecutionMonitor
Returns the execution monitor for this application, or null if not set.- Since:
- 6.0.0
-
setExecutionMonitor
Sets the execution monitor for this application, or null to disable it.Default: null.
There is at most one execution monitor for each Web application. The previous meter will be replaced when this method is called.
In addition to call this method, you could specify an execution monitor in zk.xml
- Parameters:
monitor- the execution monitor. If null, the monitor function is disabled.- Returns:
- the previous execution monitor, or null if not available.
- Since:
- 6.0.0
-
getDesktopRecycle
Returns the desktop recycle for this application, or null if not set.- Since:
- 5.0.0
-
setDesktopRecycle
Sets the desktop recycler for this application, or null to disable it.Default: null.
There is at most one desktop recycle for each Web application. The previous instance will be replaced when this method is called.
In addition to call this method, you could specify a desktop recycle in zk.xml
- Parameters:
dtRecycle- the desktop recycle. If null, the recycle function is disabled.- Returns:
- the previous desktop recycle, or null if not available.
- Since:
- 5.0.0
-
getResponseCharset
Returns the charset used to generate the HTTP response or null to use the container's default. It is currently used byDHtmlLayoutServlet,Default: UTF-8.
-
setResponseCharset
Sets the charset used to generate HTTP response. It is currently used byDHtmlLayoutServlet,- Parameters:
charset- the charset to use. If null or empty, the container's default is used.
-
getPreference
Returns the value of the preference defined in zk.xml, or bysetPreference(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
Sets the value of the preference. -
getPreferenceNames
Returns a readonly set of all preference names. -
addRichlet
Adds the definition of a richlet.If there was a richlet associated with the same name, the the old richlet will be replaced.
- Parameters:
name- the richlet nameparams- the initial parameters, or null if no initial parameter at all. Once called, the caller cannot accessparamsany more.- Returns:
- the previous richlet class or class-name with the specified name, or null if no previous richlet.
-
addRichlet
Adds the definition of a richlet.If there was a richlet associated with the same name, the the old servlet will be replaced.
- Parameters:
name- the richlet namerichletClassName- 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 accessparamsany more.- Returns:
- the previous richlet class or class-name with the specified name, or null if no previous richlet.
-
addRichlet
Adds the richlet.If there was a richlet associated with the same name, the the old one will be replaced.
- Parameters:
name- the richlet namerichlet- the richlet implemetation.- Returns:
- the previous richlet class or class-name with the specified name, or null if no previous richlet.
- Since:
- 7.0.2
-
removeRichlet
Removes the richlet and associated richlet mappings.- Parameters:
name- the richlet name- Returns:
- the removed richlet class or class-name with the specified name, or null if the richlet is not found.
- Since:
- 7.0.2
-
addRichletMapping
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. SeeaddRichlet(java.lang.String, java.lang.Class<?>, java.util.Map<java.lang.String, java.lang.String>).- Since:
- 2.4.0
-
getRichlet
Returns an instance of richlet of the specified name, or null if not found. -
getRichletByPath
Returns an instance of richlet for the specified path, or null if not found. -
detroyRichlets
public void detroyRichlets()Destroys 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
-
isDebugJS
public boolean isDebugJS()Returns whether to debug JavaScript files. If true, it means the original (i.e., uncompressed) JavaScript files shall be loaded instead of the compressed JavaScript files.- Since:
- 3.0.4
- See Also:
-
setDebugJS
public void setDebugJS(boolean debug) Sets whether to debug JavaScript files.Default: false.
If true is specified, it will try to load the original Java (i.e., uncompressed) file instead of the compressed one. For example, if
ClassWebResource.service(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)is called to load abc.js, andisDebugJS(), thenClassWebResource.service(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse)will try to load abc.org.js first. If not found, it load ab.js insted.If
isDebugJS()is false (default), abc.js is always loaded.Prior to 5.0.3, the setting won't affect JavaScript files that have been loaded. That is, the reboot is required.
- Parameters:
debug- whether to debug JavaScript files. If true, the original JavaScript files shall be loaded instead of the compressed files.- Since:
- 3.0.4
-
setExpressionFactoryClass
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 implementExpressionFactory.- Since:
- 3.0.0
-
getExpressionFactoryClass
Returns the implementation of the expression factory that is used by the whole system, or null if the system default is used.- Since:
- 3.0.0
- See Also:
-
beforeSendEvent
InvokesEventInterceptor.beforeSendEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.Used only internally.
- Since:
- 3.0.0
-
beforePostEvent
InvokesEventInterceptor.beforePostEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.Used only internally.
- Since:
- 3.0.0
-
beforeProcessEvent
InvokesEventInterceptor.beforeProcessEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.Used only internally.
- Since:
- 3.0.0
-
afterProcessEvent
InvokesEventInterceptor.afterProcessEvent(org.zkoss.zk.ui.event.Event)registered byaddListener(java.lang.Class<?>)with a class implementingEventInterceptor.Used only internally.
- Since:
- 3.0.0
-
getAttributes
Returns a map of application-specific attributes.- Since:
- 5.0.0
-
getAttribute
Returns the value of an application-specific attribute, or null if not found.- Since:
- 5.0.0
-
setAttribute
Returns the value of an application-specific attribute.- Parameters:
value- the value of the attribute. If null, it means removal, i.e.,removeAttribute(java.lang.String).- Returns:
- the previous value, or null if no such value.
- Since:
- 5.0.0
-
removeAttribute
Removes the value of an application-specific attribute.- Returns:
- the previous value, or null if no such value.
- Since:
- 5.0.0
-
addClientPackage
Adds a client (JavaScript) package that is provided by this server.Default: none.
If no package is defined (default), ZK Client Engine assumes all packages coming from the server generating the HTML page.
However, it might not be true if you want to load some client codes from different server (such as Ajax-asService). Therefore, you have to invoke this method to add the client packages if this server is going to provide JavaScript codes for other servers.
- Since:
- 5.0.0
-
getClientPackages
Returns a readonly list of the names of the client pages that are provided by this server- Since:
- 5.0.0
-
getEventTimeWarning
public int getEventTimeWarning()Returns the time, in seconds, to show a warning message if an event has been processinged longer than it.Default: 600
- Since:
- 3.6.3
-
setEventTimeWarning
public void setEventTimeWarning(int secs) Set the time, in seconds, to show a warning message if an event has been processinged longer than it.- Parameters:
secs- the number of seconds. If a non-positive number is specified, no warning message at all.- Since:
- 3.6.3
-
addErrorPage
Adds an error page.- Parameters:
deviceType- the device type: ajax or miltype- 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
Returns the error page that matches the specified error, or null if not found.- Parameters:
deviceType- the device type: ajax or milerror- the exception being thrown- Since:
- 2.4.1
-
isCustomThemeProvider
public boolean isCustomThemeProvider()Returns whether to use customThemeProvider. If true, it means the default ThemeProvider shall be ignored. It is set to true if declare custom ThemeProvider in zk.xmlDefault: false
- Since:
- 7.0.0
-
setCustomThemeProvider
public void setCustomThemeProvider(boolean customThemeProvider) Sets whether to use customThemeProvider.Default: false.
It is set to true if declare custom ThemeProvider in zk.xml
Note: internal use only
- Parameters:
customThemeProvider- whether to use customThemeProvider.- Since:
- 7.0.0
-
isCustomThemeRegistry
public boolean isCustomThemeRegistry()Returns whether to use customThemeRegistry. If true, it means the default ThemeRegistry shall be ignored. It is set to true if declare custom ThemeRegistry in zk.xmlDefault: false
- Since:
- 7.0.0
-
setCustomThemeRegistry
public void setCustomThemeRegistry(boolean customThemeRegistry) Sets whether to use customThemeRegistry.Default: false.
It is set to true if declare custom ThemeRegistry in zk.xml.
Note: internal use only
- Parameters:
customThemeRegistry- whether to use customThemeRegistry.- Since:
- 7.0.0
-
isCustomThemeResolver
public boolean isCustomThemeResolver()Returns whether to use customThemeResolver. If true, it means the default ThemeResolver shall be ignored. It is set to true if declare custom ThemeResolver in zk.xmlDefault: false
- Since:
- 7.0.0
-
setCustomThemeResolver
public void setCustomThemeResolver(boolean customThemeResolver) Sets whether to use customThemeResolver.Default: false.
It is set to true if declare custom ThemeResolver in zk.xml.
Note: internal use only
- Parameters:
customThemeResolver- whether to use customThemeResolver.- Since:
- 7.0.0
-
setInitCrashScript
Sets user customized init crash scriptUser can customize init crash page layout by defining a javascript function which is assigned to
window.zkShowCrashMessage- Parameters:
script-- Since:
- 7.0.4
-
setInitCrashTimeout
public void setInitCrashTimeout(int timeout) Sets user customized init crash timeoutUser can customize init crash timeout by simply giving a number(sec).
- Parameters:
timeout-- Since:
- 7.0.4
-
getInitCrashScript
Returns init crash script, if null, use default, see crashmsg.js- Returns:
- String
- Since:
- 7.0.4
-
getInitCrashTimeout
public int getInitCrashTimeout()Returns init crash timeout, if -1, use default, which is 60 sec- Returns:
- int
- Since:
- 7.0.4
-
getBinderInitAttribute
Returns binder init attribute name- Returns:
- String
- Since:
- 8.0.0
-
setBinderInitAttribute
Set binder init attribute name- Since:
- 8.0.0
-
getBinderAnnotations
Returns binder annotations- Returns:
- Set
- Since:
- 8.0.0
-
setBinderAnnotations
Set binder annotations- Since:
- 8.0.0
-
addDataHandler
Adds client data attribute handler- Since:
- 8.0.0
-
getDataHandlers
Returns all of the client data attribute handlers- Since:
-
enableSourceMap
public void enableSourceMap(boolean enable) Sets whether source map is enabled.Default: false (disabled).
- Since:
- 8.5.0
-
isSourceMapEnabled
public boolean isSourceMapEnabled()Returns whether source map is enabled.Default: false (disabled).
- Since:
- 8.5.0
-
enableHistoryState
public void enableHistoryState(boolean enable) Sets whether history state handle is enabled. If disabled, ZK won't generate any onHistoryPopState event even if history state is popped. It is desirable to avoid unnecessary events back to server if history state is handled by front-end.Default: true (enabled).
- Since:
- 8.6.1
-
isHistoryStateEnabled
public boolean isHistoryStateEnabled()Returns whether history state handle is enabled.Default: true (enabled).
- Since:
- 8.6.1
-
setSendClientErrors
public void setSendClientErrors(boolean send) Sets whether to send client errors to the server for logging the page url where the error occurred and its stack trace.Default: false.
- Since:
- 10.0.0
-
isSendClientErrors
public boolean isSendClientErrors()Returns whether to send client errors to the server for logging the page url where the error occurred and its stack trace.Default: false.
- Since:
- 10.0.0
-