Class EndpointUtil
java.lang.Object
org.eclipse.milo.opcua.stack.core.util.EndpointUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Stringstatic @NonNull StringGet the path component from an endpoint URL.static intstatic @Nullable Stringstatic EndpointDescriptionupdateUrl(@NonNull EndpointDescription endpoint, @Nullable String hostname) Replace the hostname in the endpoint URL field ofendpointwith a new one.static EndpointDescriptionupdateUrl(@NonNull EndpointDescription endpoint, @Nullable String hostname, int port) Replace the hostname and port in the endpoint URL field ofendpointwith new ones.
-
Constructor Details
-
EndpointUtil
public EndpointUtil()
-
-
Method Details
-
getScheme
-
getHost
-
getPort
-
getPath
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 ofendpointwith a new one.All other fields of the original
EndpointDescriptionremain equal.If the endpoint URL does not match the expected format the original endpoint is returned.
- Parameters:
endpoint- theEndpointDescriptionto modify.hostname- the new hostname to use. A null value will result in the original hostname being used.- Returns:
- an updated
EndpointDescriptionin which the hostname of the endpoint URL has been replaced withhostname.
-
updateUrl
public static EndpointDescription updateUrl(@NonNull EndpointDescription endpoint, @Nullable String hostname, int port) Replace the hostname and port in the endpoint URL field ofendpointwith new ones.All other fields of the original
EndpointDescriptionremain equal.If the endpoint URL does not match the expected format the original endpoint is returned.
- Parameters:
endpoint- theEndpointDescriptionto 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
EndpointDescriptionin which the hostname of the endpoint URL has been replaced withhostname.
-