public abstract class Uri
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Uri.ParsingMode |
Modifier and Type | Field and Description |
---|---|
static Uri |
EMPTY
Creates a default Uri to be modified using the modification methods.
|
static Uri.ParsingMode |
RELAXED |
static Uri.ParsingMode |
STRICT |
Constructor and Description |
---|
Uri() |
Modifier and Type | Method and Description |
---|---|
abstract Uri |
addPathSegment(java.lang.String segment)
Returns a copy of this instance with a path segment added at the end.
|
abstract Uri |
asScala()
Returns the Scala DSL representation of this Uri.
|
static Uri |
create(java.lang.String uri)
Returns a Uri created by parsing the given string representation.
|
static Uri |
create(java.lang.String uri,
java.nio.charset.Charset charset,
Uri.ParsingMode parsingMode)
Returns a Uri created by parsing the given string representation with the provided charset and
parsing mode.
|
static Uri |
create(java.lang.String uri,
Uri.ParsingMode parsingMode)
Returns a Uri created by parsing the given string representation with the provided parsing
mode.
|
static Uri |
create(Uri uri)
Returns the Java DSL representation of a Scala DSL Uri.
|
abstract java.util.Optional<java.lang.String> |
fragment()
Returns the fragment part of this Uri.
|
abstract Uri |
fragment(java.util.Optional<java.lang.String> fragment)
Returns a copy of this instance with a new optional fragment.
|
abstract Uri |
fragment(java.lang.String fragment)
Returns a copy of this instance with a new fragment.
|
abstract Host |
getHost()
Returns the host of this instance
|
abstract java.lang.String |
getPathString()
Returns the path of this instance
|
abstract int |
getPort()
Returns the port of this instance
|
abstract java.lang.String |
getScheme()
Returns the scheme of this instance
|
abstract java.lang.String |
getUserInfo()
Returns the user info of this instance
|
abstract Host |
host()
Returns the Host of this Uri.
|
abstract Uri |
host(Host host)
Returns a copy of this instance with a new Host.
|
abstract Uri |
host(java.lang.String host)
Returns a copy of this instance with a new host.
|
abstract boolean |
isAbsolute()
Returns if this is an absolute Uri.
|
abstract boolean |
isEmpty()
Returns if this is an empty Uri.
|
abstract boolean |
isRelative()
Returns if this is a relative Uri.
|
abstract java.lang.String |
path()
Returns a String representation of the path of this Uri.
|
abstract Uri |
path(java.lang.String path)
Returns a copy of this instance with a new path.
|
abstract java.lang.Iterable<java.lang.String> |
pathSegments()
Returns the path segments of this Uri as an Iterable.
|
abstract int |
port()
Returns the port of this Uri.
|
abstract Uri |
port(int port)
Returns a copy of this instance with a new port.
|
abstract Query |
query()
Returns the parsed Query instance of this Uri.
|
abstract Query |
query(java.nio.charset.Charset charset,
Uri.ParsingMode mode)
Returns the parsed Query instance of this Uri using the given charset and parsing mode.
|
abstract Uri |
query(Query query)
Returns a copy of this instance with a new query.
|
abstract java.util.Optional<java.lang.String> |
queryString(java.nio.charset.Charset charset)
Returns a decoded String representation of the query of this Uri.
|
abstract java.util.Optional<java.lang.String> |
rawQueryString()
Returns an undecoded String representation of the query of this Uri.
|
abstract Uri |
rawQueryString(java.lang.String rawQuery)
Returns a copy of this instance with a new query.
|
abstract Uri |
rawQueryString(java.lang.String rawQuery,
boolean strict)
Returns a copy of this instance with a new query.
|
abstract java.lang.String |
scheme()
Returns the scheme of this Uri.
|
abstract Uri |
scheme(java.lang.String scheme)
Returns a copy of this instance with a new scheme.
|
abstract Uri |
toRelative()
Returns a copy of this instance that is relative.
|
abstract java.lang.String |
userInfo()
Returns the user-info of this Uri.
|
abstract Uri |
userInfo(java.lang.String userInfo)
Returns a copy of this instance with new user-info.
|
public static final Uri.ParsingMode STRICT
public static final Uri.ParsingMode RELAXED
public static final Uri EMPTY
public abstract boolean isAbsolute()
public abstract boolean isRelative()
public abstract boolean isEmpty()
public abstract java.lang.String scheme()
public abstract Host host()
public abstract int port()
public abstract java.lang.String userInfo()
public abstract java.lang.String path()
public abstract java.lang.Iterable<java.lang.String> pathSegments()
public abstract java.util.Optional<java.lang.String> queryString(java.nio.charset.Charset charset)
public abstract java.util.Optional<java.lang.String> rawQueryString()
public abstract Query query()
public abstract Query query(java.nio.charset.Charset charset, Uri.ParsingMode mode)
public abstract java.util.Optional<java.lang.String> fragment()
public abstract Uri scheme(java.lang.String scheme)
public abstract Uri host(java.lang.String host)
public abstract Uri port(int port)
public abstract Uri userInfo(java.lang.String userInfo)
public abstract Uri path(java.lang.String path)
public abstract Uri addPathSegment(java.lang.String segment)
public abstract Uri rawQueryString(java.lang.String rawQuery)
Characters that are not within the range described at https://tools.ietf.org/html/rfc3986#section-3.4 should be percent-encoded. Characters that are in that range may or may not be percent-encoded, and depending on how the query string is parsed this might be relevant: for example, when interpreting the query string as 'key=value' pairs you could use the percent-encoded '=' ('%22) to include a '=' in the key or value.
When characters are encountered that are outside of the RFC3986 range they are automatically percent-encoded, but be aware that relying on this is usually a programming error.
public abstract Uri rawQueryString(java.lang.String rawQuery, boolean strict)
Characters that are not within the range described at https://tools.ietf.org/html/rfc3986#section-3.4 should be percent-encoded. Characters that are in that range may or may not be percent-encoded, and depending on how the query string is parsed this might be relevant: for example, when interpreting the query string as 'key=value' pairs you could use the percent-encoded '=' ('%22) to include a '=' in the key or value.
strict
- depending on the 'strict' flag, characters outside of the range allowed by
RFC3986 will either cause a `IllegalUriException` or be automatically percent-encoded. Be
aware that relying on automatic percent-encoding is usually a programming error.public abstract Uri toRelative()
public abstract Uri fragment(java.lang.String fragment)
public abstract Uri fragment(java.util.Optional<java.lang.String> fragment)
public abstract java.lang.String getScheme()
public abstract Host getHost()
public abstract int getPort()
public abstract java.lang.String getUserInfo()
public abstract java.lang.String getPathString()
public abstract Uri asScala()
public static Uri create(java.lang.String uri)
public static Uri create(java.lang.String uri, Uri.ParsingMode parsingMode)
public static Uri create(java.lang.String uri, java.nio.charset.Charset charset, Uri.ParsingMode parsingMode)