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
public class BaseWebSocketBehavior extends Behavior
A behavior that contributesWicketWebSocketJQueryResourceReference
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseWebSocketBehavior()
Constructor.BaseWebSocketBehavior(String resourceName)
Constructor.BaseWebSocketBehavior(String resourceName, String connectionToken)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 Detail
-
BaseWebSocketBehavior
protected BaseWebSocketBehavior()
Constructor. Contributes WebSocket initialization code that will work withWebSocketBehavior
-
BaseWebSocketBehavior
public BaseWebSocketBehavior(String resourceName)
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
public BaseWebSocketBehavior(String resourceName, String connectionToken)
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 Detail
-
renderHead
public void renderHead(Component component, IHeaderResponse response)
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
protected String getWebSocketSetupScript(Map<String,Object> parameters)
-
getContext
protected String getContext(Component component)
Override to return a context. By default, this is the page class name.- Parameters:
component
- theComponent
- Returns:
- the context for this websocket behavior.
-
getPort
protected Integer getPort(WebSocketSettings webSocketSettings)
-
getSecurePort
protected Integer getSecurePort(WebSocketSettings webSocketSettings)
-
getFilterPrefix
protected CharSequence getFilterPrefix(WebSocketSettings webSocketSettings)
-
getContextPath
protected CharSequence getContextPath(WebSocketSettings webSocketSettings)
-
getBaseUrl
protected CharSequence getBaseUrl(WebSocketSettings webSocketSettings)
-
getSessionId
protected CharSequence getSessionId(Component component)
- 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
public boolean getStatelessHint(Component component)
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.
-
-