Package org.zkoss.zkmax.au.websocket
Class WebSocketWebAppInit
java.lang.Object
org.zkoss.zkmax.au.websocket.WebSocketWebAppInit
- All Implemented Interfaces:
WebAppCleanup,WebAppInit
A WebAppInit implementation for WebSocket connection.
Available in ZK EE.
In WEB-INF/zk.xml, add following lines to enable WebSocket connection:
<listener>
<listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class>
</listener>
To change the update URL, you could also add the following lines into WEB-INF/zk.xml. (Optional)
If not specified, "/zkwm" will be used by default.
<library-property>
<name>org.zkoss.zkmax.au.websocket.WebSocketEndPoint.urlPattern</name>
<value>/yourApp</value>
</library-property>
When WebSocket connection is enabled, we'll use WebSocketServerPush by default when server-push started.
Note that we cannot guarantee the accessing of the information provided by http requests when WebSocket connection is enabled.- Since:
- 8.5.0
- Author:
- wenninghsu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcalled when a ZK application is about to be destroyed.static StringReturns websocket url.voidCalled when a ZK application is created and initialized.static booleanisFilterInstalled(WebApp wapp) Returns whether the websocket filter has been installed.
-
Constructor Details
-
WebSocketWebAppInit
public WebSocketWebAppInit()
-
-
Method Details
-
init
Description copied from interface:WebAppInitCalled when a ZK application is created and initialized.You could retrieve the servlet context by
WebApp.getServletContext()- Specified by:
initin interfaceWebAppInit- Throws:
Exception
-
isFilterInstalled
Returns whether the websocket filter has been installed.- Since:
- 8.5.1
-
getWebSocketUrl
Returns websocket url.- Since:
- 8.5.1
-
cleanup
Description copied from interface:WebAppCleanupcalled when a ZK application is about to be destroyed.If this method throws an exception, the error message is only logged (user won't see it).
- Specified by:
cleanupin interfaceWebAppCleanup- Throws:
Exception
-