Package org.zkoss.zats.mimic
Interface Client
-
- All Known Implementing Classes:
EmulatorClient
public interface ClientRepresent a client that can connect to zul files. It plays a role like a browser but without rendering anything.- Author:
- Hawk, Dennis, Pao, jumperchen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DesktopAgentconnect(String zulPath)connect to a zul file, you have to provide the path that relative to the resource root folderDesktopAgentconnectAsIncluded(String zulPath, Map<String,Object> args)connect to a zul file, you have to provide the path that relative to the resource root folder.DesktopAgentconnectWithContent(String content, String ext, ComponentAgent parent, Map<String,Object> args)Connect to a zul content or another language from a string.voiddestroy()destroy this client, it will also destory all un-destroyed desktops that is created by this clientStringgetCookie(String name)get value of cookie with specify name.Map<String,String>getCookies()get all cookies in an unmodifiable map.EchoEventModegetEchoEventMode()get the current echo event handling mode.voidsetCookie(String name, String value)set cookie for the client, the cookie will be sent at every HTTP request.voidsetEchoEventMode(EchoEventMode mode)change the echo event handling mode.
-
-
-
Method Detail
-
connect
DesktopAgent connect(String zulPath)
connect to a zul file, you have to provide the path that relative to the resource root folder- See Also:
ZatsEnvironment.init(String)
-
connectAsIncluded
DesktopAgent connectAsIncluded(String zulPath, Map<String,Object> args)
connect to a zul file, you have to provide the path that relative to the resource root folder. You can pass arguments through a map into the specific zul file as including.- Parameters:
zulPath- the path of zul file.args- the arguments to pass.- Returns:
- desktop agent.
- See Also:
ZatsEnvironment.init(String)
-
connectWithContent
DesktopAgent connectWithContent(String content, String ext, ComponentAgent parent, Map<String,Object> args)
Connect to a zul content or another language from a string. You can pass arguments through a map into the specific zul content or another language.- Parameters:
content- the raw content of the page. It must be a XML and compliant to the page format (such as ZUL).extension- the default extension if the content doesn't specify an language. In other words, if the content doesn't specify an language,LanguageDefinition.getByExtension(java.lang.String)is called. If extension is null and the content doesn't specify a language, the language called "xul/html" is assumed.parent- the parent component, or null if you want it to be a root component. If parent is null, the page is assumed to be the current page, which is determined by the execution context. In other words, the new component will be the root component of the current page if parent is null.arg- a map of parameters that is accessible by the arg variable in EL, or byExecution.getArg(). Ignored if null.- Returns:
- desktop agent.
- Since:
- 1.2.1
- See Also:
Executions.createComponentsDirectly(String, String, org.zkoss.zk.ui.Component, Map)
-
destroy
void destroy()
destroy this client, it will also destory all un-destroyed desktops that is created by this client
-
setCookie
void setCookie(String name, String value)
set cookie for the client, the cookie will be sent at every HTTP request. The cookie name can't start with '$'. Please refer to section 3.2.2 of RFC 2965. If the name existed, the origin value will be replaced.- Parameters:
name- The name of the cookie, it should not be null or empty string.value- The value of the cookie. If the value is null, it will erase this cookie.- Since:
- 1.1.0
-
getCookie
String getCookie(String name)
get value of cookie with specify name.- Parameters:
name- The name of the cookie, it should not be null or empty string.- Returns:
- the cookie value if cookie is existed or null otherwise.
- Since:
- 1.1.0
-
getCookies
Map<String,String> getCookies()
get all cookies in an unmodifiable map.- Returns:
- the map contained cookies.
- Since:
- 1.1.0
-
setEchoEventMode
void setEchoEventMode(EchoEventMode mode)
change the echo event handling mode. the default mode is EchoEventMode.IMMEDIATE- Parameters:
mode- Control echo event handling mode. If null, do nothing.- Since:
- 1.1.0
- See Also:
EchoEventMode
-
getEchoEventMode
EchoEventMode getEchoEventMode()
get the current echo event handling mode. the default mode is EchoEventMode.IMMEDIATE- Returns:
- current echo event handling mode.
- Since:
- 1.1.0
- See Also:
EchoEventMode
-
-