Book Image

ZK Developer's Guide

By : Jurgen Schumacher, Markus Stäuble
Book Image

ZK Developer's Guide

By: Jurgen Schumacher, Markus Stäuble

Overview of this book

<p><a href="http://www.packtpub.com/article/zk-developers-guide-table-of-contents"><br /></a></p>
Table of Contents (13 chapters)

zk.xml


Tag

Default

<richlet>

-

<listener>

-

<log>

-

<desktop-config>

-

... <desktop-timeout>

3600

... <file-check-period>

5

... <processing-prompt-delay>

900 [in milliseconds]

... <tooltip-delay>

800 [in milliseconds]

... <theme-uri>

-

.... <disable-default-theme>

-

.... <el-config>

-

.... ... <evaluator-class>

org.apache.commons.el.

ExpressionEvaluatorImpl

.... <language-config>

-

... ... <addon-uri>

-

... <session-config>

-

... ... <timeout-uri>

-

.... ... <session-timeout>

[see Webserver]

.... ... <max-desktops-persession>

10

.... <system-config>

-

.... ... <max-events-threads>

100

.... ... <max-upload-size>

5120 [in KB]

.... ... <response-charset>

UTF-8

.... ... <locale-provider-class>

-

... ... <time-zone-providerclass>

-

... ... <cache-provider-class>

org.zkoss.zk.ui.impl.

SessionDesktopCacheProvider

... ... <ui-factory-class>

org.zkoss.zk.ui.http.SimpleUiFactory

... ... <engine-class>

org.zkoss.zk.ui.impl.UiEngineImpl

.... ... <web-app-class>

org.zkoss.zk.ui.http.SimpleWebApp

.... <zscript-config>

-

.... ... <zscript-language>

-

... ... ...<language-name>

-

... ... ... <interpreter-class>

-

... <error-page>

-

... <preference>

-

... ... <name>

-

.... ... <value>

-

Configuration of ZK.XML

<richlet> Tag

The richlet tag declares a richlet. It uses two parameters,<richlet-class> and the<richlet-uri>. For example:

<richlet>
<richlet-class>com.irteam.TestRichlet</richlet-class>
<richlet-url>/test</richlet-url>
</richlet>

The richlet class must implement the org.zkoss.zk.ui.Richlet class. Be aware of the richlet-url because the "/" is necessary.

<listener> Tag

More than one listener may be specified in zk.xml. The listener may implement various interfaces. The possible interfaces are:

org.zkoss.zk.ui.event.EventThreadInit Initialize an event processing thread before an event is dispatched.

org.zkoss.zk.ui.event.EventThreadCleanup Clean up an event thread after execution.

org.zkoss.zk.ui.event.EventThreadSuspend Called before an event is going to be suspended.

org.zkoss.zk.ui.event.EventThreadResume Called when an event is resumed or aborted.

org.zkoss.zk.ui.util.WebAppInit Called when a ZK application is initialized.

org.zkoss.zk.ui.util.WebAppCleanup Clean up a ZK application, which is destroyed.

org.zkoss.zk.ui.util.SessionInit Invoked when a new Session is initialized.

org.zkoss.zk.ui.util.SessionCleanup Invoked to clean up a session that is destroyed.

org.zkoss.zk.ui.util.DesktopInit Initialize when a new desktop is created.

org.zkoss.zk.ui.util.DesktopCleanup To clean up a desktop that is destroyed.

org.zkoss.zk.ui.util.ExecutionInit Called when a new execution is initialized.

org.zkoss.zk.ui.util.ExecutionCleanup Clean up an execution which is destroyed.

org.zkoss.zk.ui.util.URIInterceptor This is used to intercept the loading of ZUML pages with the URI. It may be used to confirm if the current user should have access to the URI.

org.zkoss.zk.ui.util.Monitor This is used to monitor the status of the ZK application.

<log> Tag

Normally, the logging will be performed according to the settings in the web container. This log tag can overwrite the existing settings. If the whole package needs logging then use this tag.

<log>
<log-base></log-base>
</log>

Or use

<log>
<log-base>com.irteam.myapp</log-base>
</log>

if only the package's com.irteam.myapp.* needs logging.

<desktop-config> Tag

This has the following possible child tags: theme-uri, disable-default-theme, desktop-timeout, file-check-period, tooltip-delay, and processing-prompt-delay. The following list describes these child tags.

  1. 1. <desktop-timeout>

    This is the time between client requests, when the desktop will be timed out by the server. A negative value will never time out.

  2. 2. <disable-default-theme>

    This defines the component set whose default theme will be disabled.

  3. 3. <file-check-period>

    This is the waiting time before a file is checked for whether it is modified.

  4. 4. <processing-prompt-delay>

    This is the waiting time before a prompt will be displayed.

  5. 5. <tooltip-delay>

    This is the waiting time before a tool tip will be displayed.

  6. 6. <theme-uri>

    This defines an additional URI for style sheets.

<el-config> Tag

This tag has one child, the<evaluator-class>, and it specifies the class used to evaluate the EL expressions.

<language-config> Tag

This tag has one child, the<addon-uri> element. It defines the URI of language add-ons. It is used to add new components. This is explained in some of the later chapters in more detail.

<session-config> Tag

This element has three child tags:<timeout-uri>, <session-timeout>, and<max-desktops-per-session>.

  1. 1. <timeout-uri>

    This defines the URI the user will be redirected to, when a session is timed out.

  2. 2. <session-timeout>

    This defines the time between client requests when the session will be timed out by the server.

  3. 3. <max-desktops-per-session>

    This defines the maximum number of desktops within a session.

<system-config> Tag

This has nine child tags:<max-event-threads>, <max-upload-size>, <response-charset>, <locale-provider-class>, <time-zone-provider-class>, <cache-provider-class>, <ui-factory-class>, <engine-class>, and<web-app-class>.

  1. 1. <max-event-threads>

    This specifies the maximum allowed event handling threads.

  2. 2. <max-upload-size>

    This specifies the maximum size of a file that can be uploaded by a client.

  3. 3. <response-charset>

    This defines the charset that is used for rendering the ZUML pages.

  4. 4. <locale-provider-class>

    This defines the class that is used to determine the locale. The class must implement the org.zkoss.zk.ui.sys.LocaleProvider interface.

  5. 5. <time-zone-provider-class>

    This defines the class that is used to determine the time zone. The class must implement the org.zkoss.zk.ui.sys.TimeZoneProvider interface.

  6. 6. <cache-provider-class>

    This defines the class that is used for the desktop cache. The class must implement the org.zkoss.zk.ui.sys.DesktopCacheProvider interface. Right now (zk 2.3.0) there are two implementations available:

    • org.zkoss.zk.ui.impl.SessionDesktopCacheProvider All desktops from a session are stored in a single cache so clustering is not possible.

    • org.zkoss.zk.ui.impl.GlobalDesktopCacheProvider All desktops from a zk application are stored in a single cache.

  7. 7. <ui-factory-class>

    This defines the class that creates desktops and pages. It also maps URLs to pages. The class must implement the org.zkoss.zk.ui.sys.UiFactory interface. Right now (zk 2.3.0) there are two implementations available:

    • org.zkoss.zk.ui.http.SimpleUiFactory The generated sessions are not serializeable.

    • org.zkoss.zk.ui.http.SerializableUiFactory Here the sessions are serializable.

      The sessions can be restored after a restart of the web container.

  8. 8. <engine-class>

    This defines the class that implements the UI engine. This class must implement the org.zkoss.zk.ui.sys.UiEngine interface.

  9. 9. <webb-app-class>

    This implements the web application. It can be extended by org.zkoss.zk.ui.impl.AbstractWebApp or org.zkoss.zk.ui.http.SimpleWebApp.

<zscript-config> Tag

This defines the language and the implementation class.

<zscript-config>
<zscript-language>
<language-name>ZKJava</language-name>
<interpreter-class>com.irteam.ZKJavaInterpreter</interpreterclass>
</zscript-language>
</zscript-config>s

<error-page> Tag

This defines a URI for a specific uncaught exception..

<error-page>
<exception-type>com.irteam.Special</exception-type>
<location>/error/special.zul</location>
</error-page>

<preference> Tag

Any pair of name / value may be defined..

<preference>
<name>com.irteam.preference.AdminAccount</name>
<value>Administrator</value>
</preference>

The values can be read by the getPreference method of the org.zkoss.zk.ui.util.Configuration class.