final class HierarchicalUriComponents extends UriComponents
UriComponents
for hierarchical URIs.Modifier and Type | Class and Description |
---|---|
(package private) static class |
HierarchicalUriComponents.FullPathComponent
Represents a path backed by a String.
|
(package private) static interface |
HierarchicalUriComponents.PathComponent
Defines the contract for path (segments).
|
(package private) static class |
HierarchicalUriComponents.PathComponentComposite
Represents a collection of PathComponents.
|
(package private) static class |
HierarchicalUriComponents.PathSegmentComponent
Represents a path backed by a String list (i.e.
|
private static class |
HierarchicalUriComponents.QueryUriTemplateVariables |
(package private) static class |
HierarchicalUriComponents.Type
Enumeration used to identify the allowed characters per URI component.
|
UriComponents.UriTemplateVariables
Modifier and Type | Field and Description |
---|---|
private boolean |
encoded |
private java.lang.String |
host |
(package private) static HierarchicalUriComponents.PathComponent |
NULL_PATH_COMPONENT
Represents an empty path.
|
private HierarchicalUriComponents.PathComponent |
path |
private static char |
PATH_DELIMITER |
private static java.lang.String |
PATH_DELIMITER_STRING |
private java.lang.String |
port |
private MultiValueMap<java.lang.String,java.lang.String> |
queryParams |
private java.lang.String |
userInfo |
Constructor and Description |
---|
HierarchicalUriComponents(java.lang.String scheme,
java.lang.String userInfo,
java.lang.String host,
java.lang.String port,
HierarchicalUriComponents.PathComponent path,
MultiValueMap<java.lang.String,java.lang.String> queryParams,
java.lang.String fragment,
boolean encoded,
boolean verify)
Package-private constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyToUriComponentsBuilder(UriComponentsBuilder builder)
Set all components of the given UriComponentsBuilder.
|
HierarchicalUriComponents |
encode(java.nio.charset.Charset charset)
Encode all URI components using their specific encoding rules and return
the result as a new
UriComponents instance. |
private MultiValueMap<java.lang.String,java.lang.String> |
encodeQueryParams(java.nio.charset.Charset charset) |
(package private) static java.lang.String |
encodeUriComponent(java.lang.String source,
java.nio.charset.Charset charset,
HierarchicalUriComponents.Type type)
Encode the given source into an encoded String using the rules specified
by the given component and with the given options.
|
(package private) static java.lang.String |
encodeUriComponent(java.lang.String source,
java.lang.String encoding,
HierarchicalUriComponents.Type type)
Encode the given source into an encoded String using the rules specified
by the given component and with the given options.
|
boolean |
equals(java.lang.Object obj) |
protected HierarchicalUriComponents |
expandInternal(UriComponents.UriTemplateVariables uriVariables)
Replace all URI template variables with the values from the given
UriComponents.UriTemplateVariables |
private MultiValueMap<java.lang.String,java.lang.String> |
expandQueryParams(UriComponents.UriTemplateVariables variables) |
java.lang.String |
getHost()
Return the host.
|
private HierarchicalUriComponents.Type |
getHostType() |
java.lang.String |
getPath()
Return the path.
|
java.util.List<java.lang.String> |
getPathSegments()
Return the list of path segments.
|
int |
getPort()
Return the port.
|
java.lang.String |
getQuery()
Return the query.
|
MultiValueMap<java.lang.String,java.lang.String> |
getQueryParams()
Return the map of query parameters.
|
java.lang.String |
getSchemeSpecificPart()
Return the scheme specific part.
|
java.lang.String |
getUserInfo()
Return the user info.
|
int |
hashCode() |
UriComponents |
normalize()
Normalize the path removing sequences like "path/..".
|
java.net.URI |
toUri()
Returns a
URI from this UriComponents instance. |
java.lang.String |
toUriString()
Returns a URI String from this
UriComponents instance. |
private void |
verify()
Verifies all URI components to determine whether they contain any illegal
characters, throwing an
IllegalArgumentException if so. |
private static void |
verifyUriComponent(java.lang.String source,
HierarchicalUriComponents.Type type) |
encode, expand, expand, expand, expandUriComponent, getFragment, getScheme, toString
private static final char PATH_DELIMITER
private static final java.lang.String PATH_DELIMITER_STRING
private final java.lang.String userInfo
private final java.lang.String host
private final java.lang.String port
private final HierarchicalUriComponents.PathComponent path
private final MultiValueMap<java.lang.String,java.lang.String> queryParams
private final boolean encoded
static final HierarchicalUriComponents.PathComponent NULL_PATH_COMPONENT
HierarchicalUriComponents(java.lang.String scheme, java.lang.String userInfo, java.lang.String host, java.lang.String port, HierarchicalUriComponents.PathComponent path, MultiValueMap<java.lang.String,java.lang.String> queryParams, java.lang.String fragment, boolean encoded, boolean verify)
null
.scheme
- the schemeuserInfo
- the user infohost
- the hostport
- the portpath
- the pathqueryParams
- the query parametersfragment
- the fragmentencoded
- whether the components are already encodedverify
- whether the components need to be checked for illegal characterspublic java.lang.String getSchemeSpecificPart()
UriComponents
null
.getSchemeSpecificPart
in class UriComponents
public java.lang.String getUserInfo()
UriComponents
null
.getUserInfo
in class UriComponents
public java.lang.String getHost()
UriComponents
null
.getHost
in class UriComponents
public int getPort()
UriComponents
-1
if no port has been set.getPort
in class UriComponents
public java.lang.String getPath()
UriComponents
null
.getPath
in class UriComponents
public java.util.List<java.lang.String> getPathSegments()
UriComponents
getPathSegments
in class UriComponents
public java.lang.String getQuery()
UriComponents
null
.getQuery
in class UriComponents
public MultiValueMap<java.lang.String,java.lang.String> getQueryParams()
getQueryParams
in class UriComponents
public HierarchicalUriComponents encode(java.nio.charset.Charset charset)
UriComponents
instance.encode
in class UriComponents
charset
- the encoding of the valuesprivate MultiValueMap<java.lang.String,java.lang.String> encodeQueryParams(java.nio.charset.Charset charset)
static java.lang.String encodeUriComponent(java.lang.String source, java.lang.String encoding, HierarchicalUriComponents.Type type)
source
- the source Stringencoding
- the encoding of the source Stringtype
- the URI component for the sourcejava.lang.IllegalArgumentException
- when the given value is not a valid URI componentstatic java.lang.String encodeUriComponent(java.lang.String source, java.nio.charset.Charset charset, HierarchicalUriComponents.Type type)
source
- the source Stringcharset
- the encoding of the source Stringtype
- the URI component for the sourcejava.lang.IllegalArgumentException
- when the given value is not a valid URI componentprivate HierarchicalUriComponents.Type getHostType()
private void verify()
IllegalArgumentException
if so.java.lang.IllegalArgumentException
- if any component has illegal charactersprivate static void verifyUriComponent(java.lang.String source, HierarchicalUriComponents.Type type)
protected HierarchicalUriComponents expandInternal(UriComponents.UriTemplateVariables uriVariables)
UriComponents
UriComponents.UriTemplateVariables
expandInternal
in class UriComponents
uriVariables
- URI template valuesprivate MultiValueMap<java.lang.String,java.lang.String> expandQueryParams(UriComponents.UriTemplateVariables variables)
public UriComponents normalize()
normalize
in class UriComponents
StringUtils.cleanPath(String)
public java.lang.String toUriString()
UriComponents
instance.toUriString
in class UriComponents
public java.net.URI toUri()
URI
from this UriComponents
instance.toUri
in class UriComponents
protected void copyToUriComponentsBuilder(UriComponentsBuilder builder)
UriComponents
copyToUriComponentsBuilder
in class UriComponents
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object