Package org.apache.wicket.protocol.ws
Class WebSocketSettings
java.lang.Object
org.apache.wicket.protocol.ws.WebSocketSettings
Web Socket related settings.
More documentation is available about each setting in the setter method for the property.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Holds this WebSocketSettings in the Application's metadata.static class
Simple executor that runs the tasks in the caller thread.static class
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
getPort()
The executor that broadcasts theWebSocketPayload
via Wicket's event bus.boolean
newWebSocketRequest
(jakarta.servlet.http.HttpServletRequest request, String filterPath) A factory method for theWebRequest
that should be used in the WebSocket processing request cyclenewWebSocketRequestHandler
(Page page, IWebSocketConnection connection) A factory method for creating instances ofWebSocketRequestHandler
for processing a web socket requestnewWebSocketResponse
(IWebSocketConnection connection) A factory method for theWebResponse
that should be used to write the response back to the client/browsernewWebSocketResponse
(IWebSocketConnection connection, boolean asynchronousPush, long timeout) A factory method for theWebResponse
that should be used to write the response back to the client/browservoid
setAsynchronousPush
(boolean asynchronousPush) void
setAsynchronousPushTimeout
(long asynchronousPushTimeout) void
setBaseUrl
(CharSequence baseUrl) void
setConnectionFilter
(IWebSocketConnectionFilter connectionFilter) Sets the filter for checking the incoming connectionssetConnectionRegistry
(IWebSocketConnectionRegistry connectionRegistry) Sets the connection registryvoid
setContextPath
(CharSequence contextPath) void
setFilterPrefix
(CharSequence filterPrefix) void
setNotifyOnCloseEvent
(Function<Integer, Boolean> notifyOnCloseEvent) void
setNotifyOnErrorEvent
(Function<Throwable, Boolean> notifyOnErrorEvent) void
setPort
(int wsPort) Sets the port that should be used forws:
connections.void
setSecurePort
(int wssPort) Sets the port that should be used forwss:
connections.setSendPayloadExecutor
(Executor sendPayloadExecutor) The executor that broadcasts theWebSocketPayload
via Wicket's event bus.void
setSocketSessionConfigurer
(IWebSocketSessionConfigurer socketSessionConfigurer) Sets the IWebSocketSessionConfigurersetWebSocketPushMessageExecutor
(Executor executor) Set the executor for processing websocket push messages broadcasted to all sessions.boolean
shouldNotifyOnCloseEvent
(int closeCode) boolean
shouldNotifyOnErrorEvent
(Throwable throwable)
-
Constructor Details
-
WebSocketSettings
public WebSocketSettings()
-
-
Method Details
-
shouldNotifyOnCloseEvent
-
setNotifyOnCloseEvent
-
shouldNotifyOnErrorEvent
-
setNotifyOnErrorEvent
-
setWebSocketPushMessageExecutor
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
- Returns:
- the executor for processing websocket push messages broadcasted to all sessions.
-
getConnectionRegistry
- Returns:
- The registry that tracks all currently connected WebSocket clients
-
setConnectionRegistry
Sets the connection registry- Parameters:
connectionRegistry
- The registry that tracks all currently connected WebSocket clients- Returns:
this
, for method chaining
-
setSendPayloadExecutor
The executor that broadcasts theWebSocketPayload
via 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 toWebSocketBehavior
s andWebSocketResource
s.
-
getSendPayloadExecutor
The executor that broadcasts theWebSocketPayload
via Wicket's event bus.- Returns:
- The executor used for broadcasting the events with web socket payloads to
WebSocketBehavior
s andWebSocketResource
s.
-
setSocketSessionConfigurer
Sets the IWebSocketSessionConfigurer- Parameters:
socketSessionConfigurer
- A non-nullIWebSocketSessionConfigurer
-
getSocketSessionConfigurer
- Returns:
- returns the
IWebSocketSessionConfigurer
-
setConnectionFilter
Sets the filter for checking the incoming connections- Parameters:
connectionFilter
- the filter for checking the incoming connections- See Also:
-
getConnectionFilter
- Returns:
- the filter for checking the incoming connections
- See Also:
-
newWebSocketResponse
A factory method for theWebResponse
that 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
-
newWebSocketResponse
public WebResponse newWebSocketResponse(IWebSocketConnection connection, boolean asynchronousPush, long timeout) A factory method for theWebResponse
that should be used to write the response back to the client/browser- Parameters:
connection
- The active web socket connectionasynchronousPush
- Whether asynchronous push is wanted or not.timeout
- The timeout to be used for push operations- Returns:
- the response object that should be used to write the response back to the client
-
newWebSocketRequestHandler
public WebSocketRequestHandler newWebSocketRequestHandler(Page page, IWebSocketConnection connection) A factory method for creating instances ofWebSocketRequestHandler
for processing a web socket request- Parameters:
page
- The page with the web socket client. A dummy page in case of usage ofWebSocketResource
connection
- The active web socket connection- Returns:
- a new instance of WebSocketRequestHandler for processing a web socket request
-
newWebSocketRequest
public WebRequest newWebSocketRequest(jakarta.servlet.http.HttpServletRequest request, String filterPath) A factory method for theWebRequest
that 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
-
getFilterPrefix
-
setContextPath
-
getContextPath
-
setBaseUrl
-
getBaseUrl
-
setPort
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
- Returns:
- The custom port for WS connections
-
setSecurePort
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
- Returns:
- The custom port for WSS connections
-
setAsynchronousPush
-
isAsynchronousPush
-
setAsynchronousPushTimeout
-
getAsynchronousPushTimeout
-