Class WebsocketEndpointConfig

  • All Implemented Interfaces:

    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.
    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: * 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:////websocket/
    • Constructor Detail

      • WebsocketEndpointConfig

        public WebsocketEndpointConfig​(String urlSufix,
                                       Class<?> endpointImpl,
                                       List<String> subProtocolAccepted,
                                       Predicate<String> isOriginAllowedPredicate,
                                       int maxMessageBytesLength)
    • Method Detail

      • getUrlSufix

        public String getUrlSufix()
        Get the URL sufix where the websocket will be available.
        Specified by:
        getUrlSufix in interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        A String with the URL sufix.
      • getEndpointImpl

        public Class<?> getEndpointImpl()
        The class that implements this websocket endpoint.
        Specified by:
        getEndpointImpl in interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        A Class instance with a websocket implementation.
      • getSubProtocolAccepted

        public List<String> getSubProtocolAccepted()
        Gets the list of sub protocols that this web socket will accept. Empty if it accepts all sub protocols.
        Specified by:
        getSubProtocolAccepted in interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        A list of String with the subprotocols.
      • getIsOriginAllowedPredicate

        public Predicate<String> getIsOriginAllowedPredicate()
        Gets the predicate which evaluates if a origin is allowed for the websocket.
        Specified by:
        getIsOriginAllowedPredicate in interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        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 interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        the maximum message length in bytes.
      • getServletContextPathPropertyName

        public String getServletContextPathPropertyName()
        Get the servlet context path property.
        Specified by:
        getServletContextPathPropertyName in interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        the string with the property name.
      • getMaxMessagePropertyName

        public String getMaxMessagePropertyName()
        Get the maximum message property.
        Specified by:
        getMaxMessagePropertyName in interface org.pentaho.platform.api.websocket.IWebsocketEndpointConfig
        the string with the property name.
      • getInstanceToReadProperties

        public static WebsocketEndpointConfig getInstanceToReadProperties()
        This should be used only to get the property names values, since it gives a raw empty instance.