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 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.lang.String encoding)
Encode all URI components using their specific encoding rules and return
the result as a new
UriComponents instance. |
private static byte[] |
encodeBytes(byte[] source,
HierarchicalUriComponents.Type type) |
private MultiValueMap<java.lang.String,java.lang.String> |
encodeQueryParams(java.lang.String encoding) |
(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()
Returns the host.
|
private HierarchicalUriComponents.Type |
getHostType() |
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 |
getSchemeSpecificPart()
Returns the scheme specific part.
|
java.lang.String |
getUserInfo()
Returns 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, toStringprivate static final char PATH_DELIMITER
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()
UriComponentsnull.getSchemeSpecificPart in class UriComponentspublic java.lang.String getUserInfo()
UriComponentsnull.getUserInfo in class UriComponentspublic java.lang.String getHost()
UriComponentsnull.getHost in class UriComponentspublic int getPort()
UriComponents-1 if no port has been set.getPort in class UriComponentspublic java.lang.String getPath()
UriComponentsnull.getPath in class UriComponentspublic java.util.List<java.lang.String> getPathSegments()
UriComponentsgetPathSegments in class UriComponentspublic java.lang.String getQuery()
UriComponentsnull.getQuery in class UriComponentspublic MultiValueMap<java.lang.String,java.lang.String> getQueryParams()
getQueryParams in class UriComponentspublic HierarchicalUriComponents encode(java.lang.String encoding) throws java.io.UnsupportedEncodingException
UriComponents instance.encode in class UriComponentsencoding - the encoding of the values contained in this mapjava.io.UnsupportedEncodingException - if the given encoding is not supportedprivate MultiValueMap<java.lang.String,java.lang.String> encodeQueryParams(java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionstatic java.lang.String encodeUriComponent(java.lang.String source,
java.lang.String encoding,
HierarchicalUriComponents.Type type)
throws java.io.UnsupportedEncodingException
source - the source stringencoding - the encoding of the source stringtype - the URI component for the sourcejava.lang.IllegalArgumentException - when the given uri parameter is not a valid URIjava.io.UnsupportedEncodingExceptionprivate static byte[] encodeBytes(byte[] source,
HierarchicalUriComponents.Type type)
private 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)
UriComponentsUriComponents.UriTemplateVariablesexpandInternal in class UriComponentsuriVariables - URI template valuesprivate MultiValueMap<java.lang.String,java.lang.String> expandQueryParams(UriComponents.UriTemplateVariables variables)
public UriComponents normalize()
normalize in class UriComponentsStringUtils.cleanPath(String)public java.lang.String toUriString()
UriComponents instance.toUriString in class UriComponentspublic java.net.URI toUri()
URI from this UriComponents instance.toUri in class UriComponentsprotected void copyToUriComponentsBuilder(UriComponentsBuilder builder)
UriComponentscopyToUriComponentsBuilder in class UriComponentspublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object