Package org.openqa.selenium.net
Class Urls
- java.lang.Object
-
- org.openqa.selenium.net.Urls
-
public class Urls extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.URI
from(java.lang.String rawUri)
Convert a string, which may just be a hostname, into a validURI
.static java.net.URL
fromUri(java.net.URI uri)
static java.lang.String
urlEncode(java.lang.String value)
Encodes the text as an URL using UTF-8.
-
-
-
Method Detail
-
urlEncode
public static java.lang.String urlEncode(java.lang.String value)
Encodes the text as an URL using UTF-8.- Parameters:
value
- the text too encode- Returns:
- the encoded URI string
- See Also:
URLEncoder.encode(java.lang.String, java.lang.String)
-
fromUri
public static java.net.URL fromUri(java.net.URI uri)
-
from
public static java.net.URI from(java.lang.String rawUri)
Convert a string, which may just be a hostname, into a validURI
. If no scheme is given, it is set tohttp
by default.We prefer to use
URI
instead ofURL
since the latter requires a scheme handler to be registered for types, so strings likedocker://localhost:1234
would not generally be a validURL
but would be a correctURI
.A known limitiation is that URI fragments are not handled. In the expected use cases for this method, that is not a problem.
-
-