|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.util.UriComponentsBuilder
public class UriComponentsBuilder
Builder for UriComponents
.
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)
Constructor Summary | |
---|---|
protected |
UriComponentsBuilder()
Default constructor. |
Method Summary | |
---|---|
UriComponents |
build()
Builds a UriComponents instance from the various components contained in this builder. |
UriComponents |
build(boolean encoded)
Builds a UriComponents instance from the various components contained in this builder. |
UriComponents |
buildAndExpand(Map<String,?> uriVariables)
Builds a UriComponents instance and replaces URI template variables
with the values from a map. |
UriComponents |
buildAndExpand(Object... uriVariableValues)
Builds a UriComponents instance and replaces URI template variables
with the values from an array. |
UriComponentsBuilder |
fragment(String fragment)
Sets the URI fragment. |
static UriComponentsBuilder |
fromHttpUrl(String httpUrl)
Creates a new UriComponents object from the string HTTP URL. |
static UriComponentsBuilder |
fromPath(String path)
Returns a builder that is initialized with the given path. |
static UriComponentsBuilder |
fromUri(URI uri)
Returns a builder that is initialized with the given URI . |
static UriComponentsBuilder |
fromUriString(String uri)
Returns a builder that is initialized with the given URI string. |
UriComponentsBuilder |
host(String host)
Sets the URI host. |
static UriComponentsBuilder |
newInstance()
Returns a new, empty builder. |
UriComponentsBuilder |
path(String path)
Appends the given path to the existing path of this builder. |
UriComponentsBuilder |
pathSegment(String... pathSegments)
Appends the given path segments to the existing path of this builder. |
UriComponentsBuilder |
port(int port)
Sets the URI port. |
UriComponentsBuilder |
query(String query)
Appends the given query to the existing query of this builder. |
UriComponentsBuilder |
queryParam(String name,
Object... values)
Appends the given query parameter to the existing query parameters. |
UriComponentsBuilder |
replacePath(String path)
Sets the path of this builder overriding all existing path and path segment values. |
UriComponentsBuilder |
replaceQuery(String query)
Sets the query of this builder overriding all existing query parameters. |
UriComponentsBuilder |
replaceQueryParam(String name,
Object... values)
Sets the query parameter values overriding all existing query values for the same parameter. |
UriComponentsBuilder |
scheme(String scheme)
Sets the URI scheme. |
UriComponentsBuilder |
uri(URI uri)
Initializes all components of this URI builder with the components of the given URI. |
UriComponentsBuilder |
userInfo(String userInfo)
Sets the URI user info. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected UriComponentsBuilder()
newInstance()
,
fromPath(String)
,
fromUri(URI)
Method Detail |
---|
public static UriComponentsBuilder newInstance()
UriComponentsBuilder
public static UriComponentsBuilder fromPath(String path)
path
- the path to initialize with
UriComponentsBuilder
public static UriComponentsBuilder fromUri(URI uri)
URI
.
uri
- the URI to initialize with
UriComponentsBuilder
public static UriComponentsBuilder fromUriString(String uri)
uri
- the URI string to initialize with
UriComponentsBuilder
public static UriComponentsBuilder fromHttpUrl(String httpUrl)
UriComponents
object from the string HTTP URL.
httpUrl
- the source URI
public UriComponents build()
UriComponents
instance from the various components contained in this builder.
public UriComponents build(boolean encoded)
UriComponents
instance from the various components contained in this builder.
encoded
- whether all the components set in this builder are encoded (true
) or not (false
).
public UriComponents buildAndExpand(Map<String,?> uriVariables)
UriComponents
instance and replaces URI template variables
with the values from a map. This is a shortcut method, which combines
calls to build()
and then UriComponents.expand(Map)
.
uriVariables
- the map of URI variables
public UriComponents buildAndExpand(Object... uriVariableValues)
UriComponents
instance and replaces URI template variables
with the values from an array. This is a shortcut method, which combines
calls to build()
and then UriComponents.expand(Object...)
.
uriVariableValues
- URI variable values
public UriComponentsBuilder uri(URI uri)
uri
- the URI
public UriComponentsBuilder scheme(String scheme)
null
to clear the
scheme of this builder.
scheme
- the URI scheme
public UriComponentsBuilder userInfo(String userInfo)
null
to
clear the user info of this builder.
userInfo
- the URI user info
public UriComponentsBuilder host(String host)
null
to clear the host
of this builder.
host
- the URI host
public UriComponentsBuilder port(int port)
-1
will clear the port of this builder.
port
- the URI port
public UriComponentsBuilder path(String path)
path
- the URI path
public UriComponentsBuilder replacePath(String path)
path
- the URI path; a null
value results in an empty path.
public UriComponentsBuilder pathSegment(String... pathSegments) throws IllegalArgumentException
pathSegments
- the URI path segments
IllegalArgumentException
public UriComponentsBuilder query(String query)
query
- the query string
public UriComponentsBuilder replaceQuery(String query)
query
- the query string; a null
value removes all query parameters.
public UriComponentsBuilder queryParam(String name, Object... values)
?foo
instead of ?foo=bar
.
name
- the query parameter namevalues
- the query parameter values
public UriComponentsBuilder replaceQueryParam(String name, Object... values)
name
- the query parameter namevalues
- the query parameter values
public UriComponentsBuilder fragment(String fragment)
null
to clear
the fragment of this builder.
fragment
- the URI fragment
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |