Class WebSocketConnectionOriginFilter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ORIGIN_MISMATCH
      Explanatory text for the client to explain why the connection is getting aborted
      static int POLICY_VIOLATION_ERROR_CODE
      Error code 1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ConnectionRejected doFilter​(javax.servlet.http.HttpServletRequest servletRequest)
      Method for rejecting connections based on the current request
      java.util.List<java.lang.String> getAllowedDomains()
      The list of whitelisted domains which are allowed to initiate a websocket connection.
      void setAllowedDomains​(java.lang.Iterable<java.lang.String> domains)
      The list of whitelisted domains which are allowed to initiate a websocket connection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • POLICY_VIOLATION_ERROR_CODE

        public static final int POLICY_VIOLATION_ERROR_CODE
        Error code 1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.

        See RFC 6455, Section 7.4.1 Defined Status Codes.

        See Also:
        Constant Field Values
      • ORIGIN_MISMATCH

        public static final java.lang.String ORIGIN_MISMATCH
        Explanatory text for the client to explain why the connection is getting aborted
        See Also:
        Constant Field Values
    • Constructor Detail

      • WebSocketConnectionOriginFilter

        public WebSocketConnectionOriginFilter​(java.util.List<java.lang.String> allowedDomains)
    • Method Detail

      • setAllowedDomains

        public void setAllowedDomains​(java.lang.Iterable<java.lang.String> domains)
        The list of whitelisted domains which are allowed to initiate a websocket connection. This list will be eventually used by the IWebSocketConnectionFilter to abort potentially unsafe connections. Example domain names might be:
              http://www.example.com
              http://ww2.example.com
         
        Parameters:
        domains - The collection of domains
      • getAllowedDomains

        public java.util.List<java.lang.String> getAllowedDomains()
        The list of whitelisted domains which are allowed to initiate a websocket connection. This list will be eventually used by the IWebSocketConnectionFilter to abort potentially unsafe connections