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