public final class MutableUri extends Object implements Comparable<MutableUri>
URI substitute.
Unlike URIs, which are immutable, a MutableUri can have its fields updated independently.
That makes it easier if you just want to change a element of an Uri.URI| Constructor and Description |
|---|
MutableUri(MutableUri mutableUri)
Builds a new MutableUri with deep copy.
|
MutableUri(String uri)
Builds a new MutableUri using the given URL encoded String URI.
|
MutableUri(String scheme,
String userInfo,
String host,
int port,
String path,
String query,
String fragment)
Builds a new MutableUri using the given fields values (decoded values).
|
MutableUri(URI uri)
Builds a new MutableUri using the given URI.
|
| Modifier and Type | Method and Description |
|---|---|
URI |
asURI()
Returns the equivalent
URI instance. |
int |
compareTo(MutableUri o) |
boolean |
equals(Object o) |
String |
getAuthority()
Returns the authority compound element.
|
String |
getFragment()
Returns the fragment element.
|
String |
getHost()
Returns the host element.
|
String |
getPath()
Returns the path element.
|
List<String> |
getPathElements()
Return the URI path elements as an immutable
List. |
int |
getPort()
Returns the port element.
|
String |
getQuery()
Returns the path element.
|
String |
getRawAuthority()
Returns the raw (encoded) authority compound element.
|
String |
getRawFragment()
Returns the raw (encoded) fragment element.
|
String |
getRawPath()
Returns the raw (encoded) path element.
|
String |
getRawQuery()
Returns the raw (encoded) query element.
|
String |
getRawUserInfo()
Returns the raw (encoded) user info element.
|
String |
getScheme()
Returns the scheme name.
|
String |
getUserInfo()
Returns the user info element.
|
int |
hashCode() |
MutableUri |
rebase(MutableUri base)
Changes the base scheme, host and port of this MutableUri to that specified in a base URI,
or leaves them unchanged if the base URI is
null. |
MutableUri |
rebase(URI base)
Changes the base scheme, host and port of this MutableUri to that specified in a base URI,
or leaves them unchanged if the base URI is
null. |
MutableUri |
relativize(MutableUri uri)
Relativizes the given URI against this URI.
|
MutableUri |
resolve(MutableUri uri)
Resolves the given URI against this URI.
|
void |
setFragment(String fragment)
Update the fragment (not encoded) of this MutableUri.
|
void |
setHost(String host)
Update the host name of this MutableUri.
|
void |
setPath(String path)
Update the path (not encoded) of this MutableUri.
|
void |
setPort(int port)
Update the port of this MutableUri.
|
void |
setQuery(String query)
Update the query string (not encoded) of this MutableUri.
|
void |
setRawFragment(String rawFragment)
Update the fragment (encoded) of this MutableUri.
|
void |
setRawPath(String rawPath)
Update the pah (encoded) of this MutableUri.
|
void |
setRawQuery(String rawQuery)
Update the query (encoded) of this MutableUri.
|
void |
setRawUserInfo(String rawUserInfo)
Update the user info (encoded) of this MutableUri.
|
void |
setScheme(String scheme)
Update the scheme of this MutableUri.
|
void |
setUserInfo(String userInfo)
Update the user info (not encoded) of this MutableUri.
|
String |
toASCIIString()
Returns the content of this URI as a US-ASCII string.
|
String |
toString() |
static MutableUri |
uri(String uri)
Factory method for avoiding typing
new MutableUri("http://..."). |
public MutableUri(URI uri)
uri - URIpublic MutableUri(MutableUri mutableUri)
mutableUri - URIpublic MutableUri(String uri) throws URISyntaxException
uri - URL encoded URIURISyntaxException - if the given Uri is not well-formedpublic MutableUri(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException
scheme - Scheme nameuserInfo - User name and authorization informationhost - Host nameport - Port numberpath - Pathquery - Queryfragment - FragmentURISyntaxException - if the produced URI is not well-formedpublic static MutableUri uri(String uri) throws URISyntaxException
new MutableUri("http://...").uri - URL encoded URIURISyntaxException - if the given Uri is not well-formedpublic String getScheme()
public void setScheme(String scheme) throws URISyntaxException
scheme - new scheme nameURISyntaxException - if the new equivalent URI is invalidpublic String getUserInfo()
public String getRawUserInfo()
public void setUserInfo(String userInfo) throws URISyntaxException
userInfo - new user info element (not encoded)URISyntaxException - if the new equivalent URI is invalidpublic void setRawUserInfo(String rawUserInfo) throws URISyntaxException
rawUserInfo - new user info element (encoded)URISyntaxException - if the new equivalent URI is invalidpublic String getHost()
public void setHost(String host) throws URISyntaxException
host - new host elementURISyntaxException - if the new equivalent URI is invalidpublic int getPort()
public void setPort(int port)
throws URISyntaxException
port - new port numberURISyntaxException - if the new equivalent URI is invalidpublic String getPath()
public String getRawPath()
public void setPath(String path) throws URISyntaxException
path - new path element (not encoded)URISyntaxException - if the new equivalent URI is invalidpublic void setRawPath(String rawPath) throws URISyntaxException
rawPath - new path element (encoded)URISyntaxException - if the new equivalent URI is invalidpublic String getQuery()
public String getRawQuery()
public void setQuery(String query) throws URISyntaxException
query - new query string element (not encoded)URISyntaxException - if the new equivalent URI is invalidpublic void setRawQuery(String rawQuery) throws URISyntaxException
rawQuery - new query element (encoded)URISyntaxException - if the new equivalent URI is invalidpublic String getFragment()
public String getRawFragment()
public void setFragment(String fragment) throws URISyntaxException
fragment - new fragment element (not encoded)URISyntaxException - if the new equivalent URI is invalidpublic void setRawFragment(String rawFragment) throws URISyntaxException
rawFragment - new framgent element (encoded)URISyntaxException - if the new equivalent URI is invalidpublic String getAuthority()
public String getRawAuthority()
public List<String> getPathElements()
List. The toString method of the
returned object will return the URL-encoded path elements joined with "/".List.public MutableUri rebase(MutableUri base)
null. This implementation only
uses scheme, host and port. The remaining components of the URI remain intact.base - the URI to base the other URI on.public MutableUri rebase(URI base)
null. This implementation only
uses scheme, host and port. The remaining components of the URI remain intact.base - the URI to base the other URI on.public int compareTo(MutableUri o)
compareTo in interface Comparable<MutableUri>public MutableUri relativize(MutableUri uri)
uri - the uri to relativizes against this instanceURI.relativize(URI)public MutableUri resolve(MutableUri uri)
uri - the uri to resolve against this instanceURI.resolve(URI)public String toASCIIString()
Copyright © 2025 Open Identity Platform Community. All rights reserved.