org.zkoss.zk.device
Interface Device

All Known Implementing Classes:
AjaxDevice, GenericDevice

public interface Device

Represents a client device. For example, the HTML browsers with Ajax are called AjaxDevice, the XML output called org.zkoss.zml.device.XmlDevice, and the MIL device called org.zkoss.mil.device.MilDevice.

Note: the same device is shared by all desktops of the same device type.

Since:
2.4.0
Author:
tomyeh

Method Summary
 java.lang.String getContentType()
          Returns the default content type (never null).
 java.lang.String getDocType()
          Returns the default doc type, or null if no doc type at all.
 java.lang.Class getServerPushClass()
          Returns the class that implements the server-push feature (ServerPush) for this device, or null if the default is used.
 java.lang.String getTimeoutURI()
          Returns the timeout URI for this device.
 java.lang.String getType()
          Returns the device type.
 java.lang.String getUnavailableMessage()
          Returns the unavailable message that is shown to the client if the client doesn't support this device.
 void init(java.lang.String deviceType, DeviceConfig config)
          Initializes the device.
 boolean isCacheable()
          Returns whether the output can be cached by the client.
 void sessionDidActivate(Desktop desktop)
          Notification that the desktop, which owns this device, has just been activated (aka., deserialized) by the Web container.
 void sessionWillPassivate(Desktop desktop)
          Notification that the desktop, which owns this device, is about to be passivated (aka., serialized) by the Web container.
 java.lang.Class setServerPushClass(java.lang.Class cls)
          Sets the class that implements the server-push feature (ServerPush) for this device, or null to use the default.
 java.lang.String setTimeoutURI(java.lang.String timeoutURI)
          Sets the timeout URI.
 java.lang.String setUnavailableMessage(java.lang.String unavailmsg)
          Sets the unavailable message that is shown to the client if the client doesn't support this device.
 

Method Detail

getType

java.lang.String getType()
Returns the device type.


isCacheable

boolean isCacheable()
Returns whether the output can be cached by the client.


getUnavailableMessage

java.lang.String getUnavailableMessage()
Returns the unavailable message that is shown to the client if the client doesn't support this device.

Returns:
the unavailable message, or null if no such message
Since:
2.4.0

setUnavailableMessage

java.lang.String setUnavailableMessage(java.lang.String unavailmsg)
Sets the unavailable message that is shown to the client if the client doesn't support this device.

Parameters:
unavailmsg - the unavailable message.
Returns:
the previous unavailable message, or null if not such message
Since:
2.4.0

getTimeoutURI

java.lang.String 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).

Since:
3.0.0

setTimeoutURI

java.lang.String setTimeoutURI(java.lang.String timeoutURI)
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:
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.
Returns:
the previous timeout URI, or null if not available.
Since:
3.0.0

getServerPushClass

java.lang.Class getServerPushClass()
Returns the class that implements the server-push feature (ServerPush) for this device, or null if the default is used.

Since:
3.0.0

setServerPushClass

java.lang.Class setServerPushClass(java.lang.Class cls)
Sets the class that implements the server-push feature (ServerPush) for this device, or null to use the default.

Default: null.

If the professional edition (with zkex.jar) is loaded, the client-polling-based server push (org.zkoss.zkex.ui.impl.PollingServerPush) is the default. If the enterprise edition (with zkmax.jar) is loaded, the COMET-based server push (org.zkoss.zkmax.ui.impl.CometServerPush) is the default.

Returns:
the previous class, or null if not available.
Since:
3.0.0

getContentType

java.lang.String getContentType()
Returns the default content type (never null).

Since:
3.0.0

getDocType

java.lang.String getDocType()
Returns the default doc type, or null if no doc type at all.

Since:
3.0.0

init

void init(java.lang.String deviceType,
          DeviceConfig config)
Initializes the device. A device is created for each desktop, and this method is called when it is associated to the desktop.

Parameters:
deviceType - the device type (never null)
config - the configuration to initialize the device (never null)
Since:
3.0.0

sessionWillPassivate

void sessionWillPassivate(Desktop desktop)
Notification that the desktop, which owns this device, is about to be passivated (aka., serialized) by the Web container.

Since:
2.4.0

sessionDidActivate

void sessionDidActivate(Desktop desktop)
Notification that the desktop, which owns this device, has just been activated (aka., deserialized) by the Web container.

Since:
2.4.0


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