Package org.forgerock.http
Class MutableUri
java.lang.Object
org.forgerock.http.MutableUri
- All Implemented Interfaces:
- Comparable<MutableUri>
A MutableUri is a modifiable 
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.- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionMutableUri(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.MutableUri(MutableUri mutableUri) Builds a new MutableUri with deep copy.
- 
Method SummaryModifier and TypeMethodDescriptionasURI()Returns the equivalentURIinstance.intbooleanReturns the authority compound element.Returns the fragment element.getHost()Returns the host element.getPath()Returns the path element.Return the URI path elements as an immutableList.intgetPort()Returns the port element.getQuery()Returns the path element.Returns the raw (encoded) authority compound element.Returns the raw (encoded) fragment element.Returns the raw (encoded) path element.Returns the raw (encoded) query element.Returns the raw (encoded) user info element.Returns the scheme name.Returns the user info element.inthashCode()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 isnull.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 isnull.relativize(MutableUri uri) Relativizes the given URI against this URI.resolve(MutableUri uri) Resolves the given URI against this URI.voidsetFragment(String fragment) Update the fragment (not encoded) of this MutableUri.voidUpdate the host name of this MutableUri.voidUpdate the path (not encoded) of this MutableUri.voidsetPort(int port) Update the port of this MutableUri.voidUpdate the query string (not encoded) of this MutableUri.voidsetRawFragment(String rawFragment) Update the fragment (encoded) of this MutableUri.voidsetRawPath(String rawPath) Update the path (encoded) of this MutableUri.voidsetRawQuery(String rawQuery) Update the query (encoded) of this MutableUri.voidsetRawUserInfo(String rawUserInfo) Update the user info (encoded) of this MutableUri.voidUpdate the scheme of this MutableUri.voidsetUserInfo(String userInfo) Update the user info (not encoded) of this MutableUri.Returns the content of this URI as a US-ASCII string.toString()static MutableUriFactory method for avoiding typingnew MutableUri("http://...").
- 
Constructor Details- 
MutableUriBuilds a new MutableUri using the given URI.- Parameters:
- uri- URI
 
- 
MutableUriBuilds a new MutableUri with deep copy.- Parameters:
- mutableUri- URI
 
- 
MutableUriBuilds a new MutableUri using the given URL encoded String URI.- Parameters:
- uri- URL encoded URI
- Throws:
- URISyntaxException- if the given Uri is not well-formed
 
- 
MutableUripublic MutableUri(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException Builds a new MutableUri using the given fields values (decoded values).- Parameters:
- scheme- Scheme name
- userInfo- User name and authorization information
- host- Host name
- port- Port number
- path- Path
- query- Query
- fragment- Fragment
- Throws:
- URISyntaxException- if the produced URI is not well-formed
 
 
- 
- 
Method Details- 
uriFactory method for avoiding typingnew MutableUri("http://...").- Parameters:
- uri- URL encoded URI
- Returns:
- a new MutableUri instance
- Throws:
- URISyntaxException- if the given Uri is not well-formed
 
- 
asURIReturns the equivalentURIinstance.- Returns:
- the equivalent URIinstance
 
- 
getSchemeReturns the scheme name.- Returns:
- the scheme name
 
- 
setSchemeUpdate the scheme of this MutableUri.- Parameters:
- scheme- new scheme name
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getUserInfoReturns the user info element.- Returns:
- the user info element
 
- 
getRawUserInfoReturns the raw (encoded) user info element.- Returns:
- the raw user info element.
 
- 
setUserInfoUpdate the user info (not encoded) of this MutableUri.- Parameters:
- userInfo- new user info element (not encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
setRawUserInfoUpdate the user info (encoded) of this MutableUri.- Parameters:
- rawUserInfo- new user info element (encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getHostReturns the host element.- Returns:
- the host element
 
- 
setHostUpdate the host name of this MutableUri.- Parameters:
- host- new host element
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getPortpublic int getPort()Returns the port element.- Returns:
- the port element
 
- 
setPortUpdate the port of this MutableUri.- Parameters:
- port- new port number
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getPathReturns the path element.- Returns:
- the path element
 
- 
getRawPathReturns the raw (encoded) path element.- Returns:
- the raw path element.
 
- 
setPathUpdate the path (not encoded) of this MutableUri.- Parameters:
- path- new path element (not encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
setRawPathUpdate the path (encoded) of this MutableUri.- Parameters:
- rawPath- new path element (encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getQueryReturns the path element.- Returns:
- the path element
 
- 
getRawQueryReturns the raw (encoded) query element.- Returns:
- the raw query element.
 
- 
setQueryUpdate the query string (not encoded) of this MutableUri.- Parameters:
- query- new query string element (not encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
setRawQueryUpdate the query (encoded) of this MutableUri.- Parameters:
- rawQuery- new query element (encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getFragmentReturns the fragment element.- Returns:
- the fragment element
 
- 
getRawFragmentReturns the raw (encoded) fragment element.- Returns:
- the raw fragment element.
 
- 
setFragmentUpdate the fragment (not encoded) of this MutableUri.- Parameters:
- fragment- new fragment element (not encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
setRawFragmentUpdate the fragment (encoded) of this MutableUri.- Parameters:
- rawFragment- new framgent element (encoded)
- Throws:
- URISyntaxException- if the new equivalent URI is invalid
 
- 
getAuthorityReturns the authority compound element.- Returns:
- the authority compound element
 
- 
getRawAuthorityReturns the raw (encoded) authority compound element.- Returns:
- the authority compound element.
 
- 
getPathElementsReturn the URI path elements as an immutableList. ThetoStringmethod of the returned object will return the URL-encoded path elements joined with"/".- Returns:
- The URI path elements as an immutable List.
 
- 
rebaseChanges the base scheme, host and port of this MutableUri to that specified in a base URI, or leaves them unchanged if the base URI isnull. This implementation only uses scheme, host and port. The remaining components of the URI remain intact.- Parameters:
- base- the URI to base the other URI on.
- Returns:
- this (rebased) instance
 
- 
rebaseChanges the base scheme, host and port of this MutableUri to that specified in a base URI, or leaves them unchanged if the base URI isnull. This implementation only uses scheme, host and port. The remaining components of the URI remain intact.- Parameters:
- base- the URI to base the other URI on.
- Returns:
- this (rebased) instance
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<MutableUri>
 
- 
relativizeRelativizes the given URI against this URI.- Parameters:
- uri- the uri to relativizes against this instance
- Returns:
- this instance (mutated)
- See Also:
 
- 
resolveResolves the given URI against this URI.- Parameters:
- uri- the uri to resolve against this instance
- Returns:
- this instance (mutated)
- See Also:
 
- 
toString
- 
toASCIIStringReturns the content of this URI as a US-ASCII string.- Returns:
- the content of this URI as a US-ASCII string
 
- 
equals
- 
hashCodepublic int hashCode()
 
-