Class BaseWebSocketBehavior
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.protocol.ws.api.BaseWebSocketBehavior
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IComponentAwareHeaderContributor
,IClusterable
- Direct Known Subclasses:
WebSocketBehavior
A behavior that contributes
WicketWebSocketJQueryResourceReference
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor.BaseWebSocketBehavior
(String resourceName) Constructor.BaseWebSocketBehavior
(String resourceName, String connectionToken) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected CharSequence
getBaseUrl
(WebSocketSettings webSocketSettings) protected String
getContext
(Component component) Override to return a context.protected CharSequence
getContextPath
(WebSocketSettings webSocketSettings) protected CharSequence
getFilterPrefix
(WebSocketSettings webSocketSettings) protected Integer
getPort
(WebSocketSettings webSocketSettings) protected Integer
getSecurePort
(WebSocketSettings webSocketSettings) protected CharSequence
getSessionId
(Component component) boolean
getStatelessHint
(Component component) This method returns false if the behavior generates a callback url (for example ajax behaviors)protected String
getWebSocketSetupScript
(Map<String, Object> parameters) void
renderHead
(Component component, IHeaderResponse response) Render to the web response whatever the component wants to contribute to the head section.Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListener, detach, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, unbind
-
Constructor Details
-
BaseWebSocketBehavior
protected BaseWebSocketBehavior()Constructor. Contributes WebSocket initialization code that will work withWebSocketBehavior
-
BaseWebSocketBehavior
Constructor. Contributes WebSocket initialization code that will work withWebSocketResource
To use WebSocketResource the application have to setup the resource as a shared one in itsApplication.init()
method:getSharedResources().add(resourceName, new MyWebSocketResource())
- Parameters:
resourceName
- the name of the sharedWebSocketResource
-
BaseWebSocketBehavior
Constructor. Contributes WebSocket initialization code that will work withWebSocketResource
To use WebSocketResource the application have to setup the resource as a shared one in itsApplication.init()
method:getSharedResources().add(resourceName, new MyWebSocketResource())
- Parameters:
resourceName
- the name of the sharedWebSocketResource
connectionToken
- an optional token to support connections to the same resource from multiple browser tabs
-
-
Method Details
-
renderHead
Description copied from class:Behavior
Render to the web response whatever the component wants to contribute to the head section.- Specified by:
renderHead
in interfaceIComponentAwareHeaderContributor
- Overrides:
renderHead
in classBehavior
- Parameters:
component
- component which is contributing to the response. This parameter is here to give the component as the context for component-awares implementing this interfaceresponse
- Response object
-
getWebSocketSetupScript
-
getContext
Override to return a context. By default, this is the page class name.- Parameters:
component
- theComponent
- Returns:
- the context for this websocket behavior.
-
getPort
-
getSecurePort
-
getFilterPrefix
-
getContextPath
-
getBaseUrl
-
getSessionId
- Parameters:
component
- The component this behavior is bound to- Returns:
- The http session id if it is tracked in the url, otherwise empty string
-
getStatelessHint
Description copied from class:Behavior
This method returns false if the behavior generates a callback url (for example ajax behaviors)- Overrides:
getStatelessHint
in classBehavior
- Parameters:
component
- the component that has this behavior coupled.- Returns:
- boolean true or false.
-