java.lang.Object
org.eclipse.milo.opcua.stack.core.util.EndpointUtil

public class EndpointUtil extends Object
  • Constructor Details

    • EndpointUtil

      public EndpointUtil()
  • Method Details

    • getScheme

      public static @Nullable String getScheme(String endpointUrl)
    • getHost

      public static @Nullable String getHost(String endpointUrl)
    • getPort

      public static int getPort(String endpointUrl)
    • getPath

      public static @NonNull String getPath(String endpointUrl)
      Get the path component from an endpoint URL.

      An empty path becomes "/" and trailing "/" are removed from non-empty paths.

      Parameters:
      endpointUrl - the endpoint URL.
      Returns:
      the path component from the endpoint URL.
    • updateUrl

      public static EndpointDescription updateUrl(@NonNull EndpointDescription endpoint, @Nullable String hostname)
      Replace the hostname in the endpoint URL field of endpoint with a new one.

      All other fields of the original EndpointDescription remain equal.

      If the endpoint URL does not match the expected format the original endpoint is returned.

      Parameters:
      endpoint - the EndpointDescription to modify.
      hostname - the new hostname to use. A null value will result in the original hostname being used.
      Returns:
      an updated EndpointDescription in which the hostname of the endpoint URL has been replaced with hostname.
    • updateUrl

      public static EndpointDescription updateUrl(@NonNull EndpointDescription endpoint, @Nullable String hostname, int port)
      Replace the hostname and port in the endpoint URL field of endpoint with new ones.

      All other fields of the original EndpointDescription remain equal.

      If the endpoint URL does not match the expected format the original endpoint is returned.

      Parameters:
      endpoint - the EndpointDescription to modify.
      hostname - the new hostname to use. A null value will result in the original hostname being used.
      port - the new port to use. Any value less than or equal to 0 will result in the original port being used.
      Returns:
      an updated EndpointDescription in which the hostname of the endpoint URL has been replaced with hostname.