UriComponents.
Typical usage involves:
UriComponentsBuilder with one of the static factory methods
(such as fromPath(String) or fromUri(URI))scheme(String),
userInfo(String), host(String), port(int), path(String),
pathSegment(String...) , queryParam(String, Object...) , and
fragment(String).UriComponents instance with the build() method.newInstance(), fromPath(String), fromUri(URI)
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static enum | |
| private static class | |
| private static interface | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private Charset | |
| private static final Object[] | |
| private boolean | |
| private String | |
| private String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final Pattern | |
| private static final String | |
| private static final String | |
| private UriComponentsBuilder. | |
| private String | |
| private static final String | |
| private static final Pattern | |
| private static final String | |
| private final MultiValueMap | |
| private String | |
| private static final String | |
| private String | |
| private static final Pattern | |
| private final Map | |
| private String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | UriComponentsBuilder(UriComponentsBuilder
the other builder to copy from other)Create a deep copy of the given UriComponentsBuilder. |
| Modifier and Type | Method and Description |
|---|---|
| public UriComponents | Returns: the URI componentsBuild a |
| public UriComponents | Returns: the URI componentswhether the components in this builder are already encoded encoded)Variant of |
| public URI | build(Object...
the map of URI variables uriVariables)Implements org. URI instance and replaces URI template variables
with the values from an array.
|
| public URI | build(Map<String, ?>
the map of URI variables uriVariables)Implements org. URI instance and replaces URI template variables
with the values from a map.
|
| public UriComponents | Returns: the URI components with expanded valuesthe map of URI variables uriVariables)Build a |
| public UriComponents | Returns: the URI components with expanded valuesthe URI variable values uriVariableValues)Build a |
| private UriComponents | |
| public Object | |
| public UriComponentsBuilder | |
| public final UriComponentsBuilder | encode()
Request to have the URI template pre-encoded at build time, and URI variables encoded separately when expanded. |
| public UriComponentsBuilder | |
| public UriComponentsBuilder | fragment(String
the URI fragment fragment)Implements org. |
| public static UriComponentsBuilder | Returns: the URI components of the URIthe source request request)
Deprecated
for removal since 6.1. in favor of
Create a new ForwardedHeaderUtils#adaptFromForwardedHeaders;
to be removed in 6.2
UriComponents object from the URI associated with
the given HttpRequest while also overlaying with values from the headers
"Forwarded" (RFC 7239),
or "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" if
"Forwarded" is not found.
|
| public static UriComponentsBuilder | Returns: the URI components of the URIthe source URI httpUrl)Create a URI components builder from the given HTTP URL String. |
| public static UriComponentsBuilder | fromOriginHeader(String origin)
Create an instance by parsing the "Origin" header of an HTTP request. |
| public static UriComponentsBuilder | |
| public static UriComponentsBuilder | |
| public static UriComponentsBuilder | Returns: the newUriComponentsBuilderthe URI string to initialize with uri)Create a builder that is initialized with the given URI string. |
| private String | |
| public UriComponentsBuilder | host(String
the URI host host)Implements org. null to clear the host of this builder.
|
| public static UriComponentsBuilder | |
| public static InetSocketAddress | Returns: anInetSocketAddress with the extracted host and port, or
null if the headers are not present.a request with headers that may contain forwarded headers request, InetSocketAddress the current remoteAddress remoteAddress)
Deprecated
for removal since 6.1. in favor of
Parse the first "Forwarded: for=..." or "X-Forwarded-For" header value to
an ForwardedHeaderUtils#parseForwardedFor;
to be removed in 6.2
InetSocketAddress representing the address of the client.
|
| public UriComponentsBuilder | path(String
the URI path path)Implements org. |
| public UriComponentsBuilder | pathSegment(String...
the URI path segments pathSegments)Implements org. |
| public UriComponentsBuilder | port(int
the URI port port)Implements org. |
| public UriComponentsBuilder | port(String
the URI port port)Implements org. |
| public UriComponentsBuilder | query(String
the query string query)Implements org. '&' and their values, if any, with '='.
|
| public UriComponentsBuilder | queryParam(String
the query parameter name name, Object... the query parameter values values)Implements org. |
| public UriComponentsBuilder | queryParam(String
the query parameter name name, Collection<?> the query parameter values values)Implements org. queryParam(String, Object. with a Collection.
|
| public UriComponentsBuilder | queryParamIfPresent(String
the query parameter name name, Optional<?> an Optional, either empty or holding the query parameter value. value)Implements org. queryParam(String, Object. or
queryParam(String, Collection) if the given Optional has
a value, or else if it is empty, no query parameter is added at all.
|
| public UriComponentsBuilder | queryParams(MultiValueMap<String, String>
the params params)Implements org. |
| public UriComponentsBuilder | replacePath(String
the URI path, or path)null for an empty pathImplements org. |
| public UriComponentsBuilder | replaceQuery(String
the query string; a query)null value removes all query parameters.Implements org. query(String).
|
| public UriComponentsBuilder | replaceQueryParam(String
the query parameter name name, Object... the query parameter values values)Implements org. |
| public UriComponentsBuilder | replaceQueryParam(String
the query parameter name name, Collection<?> the query parameter values values)Implements org. replaceQueryParam(String, Object. with a Collection.
|
| public UriComponentsBuilder | replaceQueryParams(MultiValueMap<String, String>
the query parameter name params)Implements org. |
| private void | |
| pack-priv void | |
| private void | |
| public UriComponentsBuilder | scheme(String
the URI scheme scheme)Implements org. null to clear the scheme of this builder.
|
| public UriComponentsBuilder | Returns: this UriComponentsBuilderthe URI scheme-specific-part, may contain URI template parameters ssp)Set the URI scheme-specific-part. |
| public String | |
| public UriComponentsBuilder | |
| public UriComponentsBuilder | Returns: this UriComponentsBuilderthe UriComponents to copy from uriComponents)Set or append individual URI components of this builder from the values
of the given |
| public UriComponentsBuilder | Returns: this UriComponentsBuilderthe URI variables to use uriVariables)Configure URI variables to be expanded at build time. |
| public UriComponentsBuilder | userInfo(String
the URI user info userInfo)Implements org. null to clear the user info of this builder.
|