public final class UriComponents
extends java.lang.Object
URI
, but with more powerful encoding options and support
for URI template variables.UriComponentsBuilder
Modifier and Type | Method and Description |
---|---|
UriComponents |
encode()
Encodes all URI components using their specific encoding rules, and returns the result as a new
UriComponents instance. |
UriComponents |
encode(java.lang.String encoding)
Encodes all URI components using their specific encoding rules, and returns the result as a new
UriComponents instance. |
boolean |
equals(java.lang.Object o) |
UriComponents |
expand(java.util.Map<java.lang.String,?> uriVariables)
Replaces all URI template variables with the values from a given map.
|
UriComponents |
expand(java.lang.Object... uriVariableValues)
Replaces all URI template variables with the values from a given array.
|
java.lang.String |
getFragment()
Returns the fragment.
|
java.lang.String |
getHost()
Returns the host.
|
java.lang.String |
getPath()
Returns the path.
|
java.util.List<java.lang.String> |
getPathSegments()
Returns the list of path segments.
|
int |
getPort()
Returns the port.
|
java.lang.String |
getQuery()
Returns the query.
|
MultiValueMap<java.lang.String,java.lang.String> |
getQueryParams()
Returns the map of query parameters.
|
java.lang.String |
getScheme()
Returns the scheme.
|
java.lang.String |
getUserInfo()
Returns the user info.
|
int |
hashCode() |
UriComponents |
normalize()
Normalize the path removing sequences like "path/..".
|
java.lang.String |
toString() |
java.net.URI |
toUri()
Returns a
URI from this UriComponents instance. |
java.lang.String |
toUriString()
Returns a URI string from this
UriComponents instance. |
public java.lang.String getScheme()
null
.public java.lang.String getUserInfo()
null
.public java.lang.String getHost()
null
.public int getPort()
-1
if no port has been set.public java.lang.String getPath()
null
.public java.util.List<java.lang.String> getPathSegments()
public java.lang.String getQuery()
null
.public MultiValueMap<java.lang.String,java.lang.String> getQueryParams()
public java.lang.String getFragment()
null
.public UriComponents encode()
UriComponents
instance. This method uses UTF-8 to encode.public UriComponents encode(java.lang.String encoding) throws java.io.UnsupportedEncodingException
UriComponents
instance.encoding
- the encoding of the values contained in this mapjava.io.UnsupportedEncodingException
- if the given encoding is not supportedpublic UriComponents expand(java.util.Map<java.lang.String,?> uriVariables)
uriVariables
- the map of URI variablespublic UriComponents expand(java.lang.Object... uriVariableValues)
uriVariableValues
- URI variable valuespublic UriComponents normalize()
StringUtils.cleanPath(String)
public java.lang.String toUriString()
UriComponents
instance.public java.net.URI toUri()
URI
from this UriComponents
instance.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object