Package org.apache.wicket.protocol.ws
Class WebSocketSettings
- java.lang.Object
-
- org.apache.wicket.protocol.ws.WebSocketSettings
-
public class WebSocketSettings extends java.lang.ObjectWeb Socket related settings. More documentation is available about each setting in the setter method for the property.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWebSocketSettings.HolderHolds this WebSocketSettings in the Application's metadata.static classWebSocketSettings.SameThreadExecutorSimple executor that runs the tasks in the caller thread.
-
Constructor Summary
Constructors Constructor Description WebSocketSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.CharSequencegetBaseUrl()IWebSocketConnectionFiltergetConnectionFilter()IWebSocketConnectionRegistrygetConnectionRegistry()java.lang.CharSequencegetContextPath()java.lang.CharSequencegetFilterPrefix()java.lang.IntegergetPort()java.lang.IntegergetSecurePort()ExecutorgetSendPayloadExecutor()The executor that broadcasts theWebSocketPayloadvia Wicket's event bus.ExecutorgetWebSocketPushMessageExecutor()org.apache.wicket.request.http.WebRequestnewWebSocketRequest(javax.servlet.http.HttpServletRequest request, java.lang.String filterPath)A factory method for theWebRequestthat should be used in the WebSocket processing request cycleWebSocketRequestHandlernewWebSocketRequestHandler(org.apache.wicket.Page page, IWebSocketConnection connection)A factory method for creating instances ofWebSocketRequestHandlerfor processing a web socket requestorg.apache.wicket.request.http.WebResponsenewWebSocketResponse(IWebSocketConnection connection)A factory method for theWebResponsethat should be used to write the response back to the client/browservoidsetBaseUrl(java.lang.CharSequence baseUrl)voidsetConnectionFilter(IWebSocketConnectionFilter connectionFilter)Sets the filter for checking the incoming connectionsWebSocketSettingssetConnectionRegistry(IWebSocketConnectionRegistry connectionRegistry)Sets the connection registryvoidsetContextPath(java.lang.CharSequence contextPath)voidsetFilterPrefix(java.lang.CharSequence filterPrefix)voidsetPort(int wsPort)Sets the port that should be used forws:connections.voidsetSecurePort(int wssPort)Sets the port that should be used forwss:connections.WebSocketSettingssetSendPayloadExecutor(Executor sendPayloadExecutor)The executor that broadcasts theWebSocketPayloadvia Wicket's event bus.WebSocketSettingssetWebSocketPushMessageExecutor(Executor executor)Set the executor for processing websocket push messages broadcasted to all sessions.
-
-
-
Method Detail
-
setWebSocketPushMessageExecutor
public WebSocketSettings setWebSocketPushMessageExecutor(Executor executor)
Set the executor for processing websocket push messages broadcasted to all sessions. Default executor does all the processing in the caller thread. Using a proper thread pool is adviced for applications that send push events from ajax calls to avoid page level deadlocks.- Parameters:
executor- The executor used for processing push messages.
-
getWebSocketPushMessageExecutor
public Executor getWebSocketPushMessageExecutor()
- Returns:
- the executor for processing websocket push messages broadcasted to all sessions.
-
getConnectionRegistry
public IWebSocketConnectionRegistry getConnectionRegistry()
- Returns:
- The registry that tracks all currently connected WebSocket clients
-
setConnectionRegistry
public WebSocketSettings setConnectionRegistry(IWebSocketConnectionRegistry connectionRegistry)
Sets the connection registry- Parameters:
connectionRegistry- The registry that tracks all currently connected WebSocket clients- Returns:
this, for method chaining
-
setSendPayloadExecutor
public WebSocketSettings setSendPayloadExecutor(Executor sendPayloadExecutor)
The executor that broadcasts theWebSocketPayloadvia Wicket's event bus. Default executor does all the processing in the caller thread.- Parameters:
sendPayloadExecutor- The executor used for broadcasting the events with web socket payloads toWebSocketBehaviors andWebSocketResources.
-
getSendPayloadExecutor
public Executor getSendPayloadExecutor()
The executor that broadcasts theWebSocketPayloadvia Wicket's event bus.- Returns:
- The executor used for broadcasting the events with web socket payloads to
WebSocketBehaviors andWebSocketResources.
-
setConnectionFilter
public void setConnectionFilter(IWebSocketConnectionFilter connectionFilter)
Sets the filter for checking the incoming connections- Parameters:
connectionFilter- the filter for checking the incoming connections- See Also:
WebSocketConnectionFilterCollection
-
getConnectionFilter
public IWebSocketConnectionFilter getConnectionFilter()
- Returns:
- the filter for checking the incoming connections
- See Also:
WebSocketConnectionFilterCollection
-
newWebSocketResponse
public org.apache.wicket.request.http.WebResponse newWebSocketResponse(IWebSocketConnection connection)
A factory method for theWebResponsethat should be used to write the response back to the client/browser- Parameters:
connection- The active web socket connection- Returns:
- the response object that should be used to write the response back to the client
-
newWebSocketRequestHandler
public WebSocketRequestHandler newWebSocketRequestHandler(org.apache.wicket.Page page, IWebSocketConnection connection)
A factory method for creating instances ofWebSocketRequestHandlerfor processing a web socket request- Parameters:
page- The page with the web socket client. A dummy page in case of usage ofWebSocketResourceconnection- The active web socket connection- Returns:
- a new instance of WebSocketRequestHandler for processing a web socket request
-
newWebSocketRequest
public org.apache.wicket.request.http.WebRequest newWebSocketRequest(javax.servlet.http.HttpServletRequest request, java.lang.String filterPath)A factory method for theWebRequestthat should be used in the WebSocket processing request cycle- Parameters:
request- The upgraded http requestfilterPath- The configured filter path of WicketFilter in web.xml- Returns:
- the request object that should be used in the WebSocket processing request cycle
-
setFilterPrefix
public void setFilterPrefix(java.lang.CharSequence filterPrefix)
-
getFilterPrefix
public java.lang.CharSequence getFilterPrefix()
-
setContextPath
public void setContextPath(java.lang.CharSequence contextPath)
-
getContextPath
public java.lang.CharSequence getContextPath()
-
setBaseUrl
public void setBaseUrl(java.lang.CharSequence baseUrl)
-
getBaseUrl
public java.lang.CharSequence getBaseUrl()
-
setPort
public void setPort(int wsPort)
Sets the port that should be used forws:connections. If unset then the current HTTP port will be used.- Parameters:
wsPort- The custom port for WS connections
-
getPort
public java.lang.Integer getPort()
- Returns:
- The custom port for WS connections
-
setSecurePort
public void setSecurePort(int wssPort)
Sets the port that should be used forwss:connections. If unset then the current HTTPS port will be used.- Parameters:
wssPort- The custom port for WSS connections
-
getSecurePort
public java.lang.Integer getSecurePort()
- Returns:
- The custom port for WSS connections
-
-