public abstract class UriComponents extends Object implements Serializable
URI
, but with more powerful encoding options and support for
URI template variables.UriComponentsBuilder
,
Serialized FormModifier and Type | Class and Description |
---|---|
static interface |
UriComponents.UriTemplateVariables
Defines the contract for URI Template variables
|
Modifier | Constructor and Description |
---|---|
protected |
UriComponents(String scheme,
String fragment) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
copyToUriComponentsBuilder(UriComponentsBuilder builder)
Set all components of the given UriComponentsBuilder.
|
UriComponents |
encode()
Encode all URI components using their specific encoding rules, and returns the
result as a new
UriComponents instance. |
abstract UriComponents |
encode(String encoding)
Encode all URI components using their specific encoding rules, and
returns the result as a new
UriComponents instance. |
UriComponents |
expand(Map<String,?> uriVariables)
Replace all URI template variables with the values from a given map.
|
UriComponents |
expand(Object... uriVariableValues)
Replace all URI template variables with the values from a given array.
|
UriComponents |
expand(UriComponents.UriTemplateVariables uriVariables)
Replace all URI template variables with the values from the given
UriComponents.UriTemplateVariables . |
String |
getFragment()
Return the fragment.
|
abstract String |
getHost()
Return the host.
|
abstract String |
getPath()
Return the path.
|
abstract List<String> |
getPathSegments()
Return the list of path segments.
|
abstract int |
getPort()
Return the port.
|
abstract String |
getQuery()
Return the query.
|
abstract MultiValueMap<String,String> |
getQueryParams()
Return the map of query parameters.
|
String |
getScheme()
Return the scheme.
|
abstract String |
getSchemeSpecificPart()
Return the scheme specific part.
|
abstract String |
getUserInfo()
Return the user info.
|
abstract UriComponents |
normalize()
Normalize the path removing sequences like "path/..".
|
String |
toString() |
abstract URI |
toUri()
Return a
URI from this UriComponents instance. |
abstract String |
toUriString()
Return a URI String from this
UriComponents instance. |
public final String getScheme()
null
.public final String getFragment()
null
.public abstract String getSchemeSpecificPart()
null
.public abstract String getUserInfo()
null
.public abstract String getHost()
null
.public abstract int getPort()
-1
if no port has been set.public abstract String getPath()
null
.public abstract List<String> getPathSegments()
public abstract String getQuery()
null
.public abstract MultiValueMap<String,String> getQueryParams()
public final UriComponents encode()
UriComponents
instance. This method uses UTF-8 to encode.public abstract 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 final UriComponents expand(Map<String,?> uriVariables)
The given map keys represent variable names; the corresponding values represent variable values. The order of variables is not significant.
uriVariables
- the map of URI variablespublic final UriComponents expand(Object... uriVariableValues)
The given array represents variable values. The order of variables is significant.
uriVariableValues
- the URI variable valuespublic final UriComponents expand(UriComponents.UriTemplateVariables uriVariables)
UriComponents.UriTemplateVariables
.uriVariables
- the URI template valuespublic abstract UriComponents normalize()
StringUtils.cleanPath(String)
public abstract String toUriString()
UriComponents
instance.public abstract URI toUri()
URI
from this UriComponents
instance.protected abstract void copyToUriComponentsBuilder(UriComponentsBuilder builder)