Class WebsocketEndpointConfig
java.lang.Object
org.pentaho.platform.web.websocket.WebsocketEndpointConfig
- All Implemented Interfaces:
org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
public class WebsocketEndpointConfig
extends Object
implements org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
This class should be used to configure a websocket endpoint in platform plugins.
Declare a bean in the plugin.spring.xml on your platform plugin.
/websocket/
The CORS utility class usage is used as an example on how to pass a predicate as a parameter (use any other mean that you found useful). The predicate can implement just the following code:<constructor-arg value="query"/> <constructor-arg type="java.lang.Class" value=" "/> <constructor-arg> </constructor-arg> <constructor-arg value="#{corsUtil.isCorsRequestOriginAllowedPredicate()}" /> <constructor-arg value="8192" />
sub_protocol_value
* return domain -> this.getDomainWhitelist().contains( domain );
For the websocket endpoint implementation you should go with an implementation of the
Endpoint
class, in order to have the endpoint registered in the platform.
The websocket is created in the PluginDispatchServlet
initialization.
The endpoint will be ws://<server:port>/-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
The class that implements this websocket endpoint.static WebsocketEndpointConfig
This should be used only to get the property names values, since it gives a raw empty instance.Gets the predicate which evaluates if a origin is allowed for the websocket.int
Gets the maximum message length in bytes.Get the maximum message property.Get the servlet context path property.Gets the list of sub protocols that this web socket will accept.Get the URL sufix where the websocket will be available.
-
Constructor Details
-
WebsocketEndpointConfig
-
-
Method Details
-
getUrlSufix
Get the URL sufix where the websocket will be available.- Specified by:
getUrlSufix
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- A String with the URL sufix.
-
getEndpointImpl
The class that implements this websocket endpoint.- Specified by:
getEndpointImpl
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- A
Class
instance with a websocket implementation.
-
getSubProtocolAccepted
Gets the list of sub protocols that this web socket will accept. Empty if it accepts all sub protocols.- Specified by:
getSubProtocolAccepted
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- A list of
String
with the subprotocols.
-
getIsOriginAllowedPredicate
Gets the predicate which evaluates if a origin is allowed for the websocket.- Specified by:
getIsOriginAllowedPredicate
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- a predicate that accepts a String and checks if the origin received as parameter is accepted.
-
getMaxMessageBytesLength
public int getMaxMessageBytesLength()Gets the maximum message length in bytes.- Specified by:
getMaxMessageBytesLength
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- the maximum message length in bytes.
-
getServletContextPathPropertyName
Get the servlet context path property.- Specified by:
getServletContextPathPropertyName
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- the string with the property name.
-
getMaxMessagePropertyName
Get the maximum message property.- Specified by:
getMaxMessagePropertyName
in interfaceorg.pentaho.platform.api.websocket.IWebsocketEndpointConfig
- Returns:
- the string with the property name.
-
getInstanceToReadProperties
This should be used only to get the property names values, since it gives a raw empty instance.- Returns:
-