Class WebSocketUtil

java.lang.Object
org.drasyl.util.WebSocketUtil

public final class WebSocketUtil extends Object
Utility class for operations on websocket URIs (e.g. ws://foo.bar).
  • Field Details

  • Method Details

    • webSocketPort

      public static int webSocketPort(URI uri)
      Parameters:
      uri - the URI to be used for determining the WebSocket URI
      Returns:
      the port in the WebSocket URI. If no custom port is specified, the protocol default port is assumed
      Throws:
      IllegalArgumentException - if no port could be determined
      NullPointerException - if uri is null
    • isWebSocketSecureURI

      public static boolean isWebSocketSecureURI(URI uri)
      Parameters:
      uri - the URI to be checked
      Returns:
      true if uri is a WebSocket Secure URI. Otherwise, returns false
      Throws:
      NullPointerException - if uri is null
    • isWebSocketNonSecureURI

      public static boolean isWebSocketNonSecureURI(URI uri)
      Parameters:
      uri - the URI to be checked
      Returns:
      true if uri is a non-secure Websocket URI. Otherwise, returns false
      Throws:
      NullPointerException - if uri is null
    • isWebSocketURI

      public static boolean isWebSocketURI(URI uri)
      Parameters:
      uri - the URI to be checked
      Returns:
      true if uri is Websocket URI. Otherwise, returns false
      Throws:
      NullPointerException - if uri is null