java.net · java.base · since Java 1.4

URI

declaration
public final class URI implements Comparable<URI>, Serializable

Parsed, immutable resource identifier — scheme, host, path, query — with proper escaping rules. The type HttpClient and modern APIs want.

Key methods

static URI create(String str)Parse (unchecked exception on syntax errors).
String getHost() / getPath() / getQuery()Components.
URI resolve(String str)Relative reference resolution.