org.springframework.web.util.UriComponentsBuilder
by pointing to @RequestMapping methods on Spring MVC controllers.
There are several groups of methods:
fromXxx(...) methods to prepare links using information
from the current request as determined by a call to
org.springframework.web.servlet.support.ServletUriComponentsBuilder#fromCurrentServletMapping() .
fromXxx(UriComponentsBuilder,...) methods can be given
a baseUrl when operating outside the context of a request.
withXxx(...) methods where an instance of
MvcUriComponentsBuilder is created with a baseUrl via
relativeTo(org.springframework.web.util.UriComponentsBuilder) .
Note
This class uses values from "Forwarded"
(RFC 7239),
"X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers,
if present, in order to reflect the client-originated protocol and address.
Consider using the ForwardedHeaderFilter in order to choose from a
central place whether to extract and use, or to discard such headers.
See the Spring Framework reference for more on this filter.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static class | MvcUriComponentsBuilder.
Builder class to create URLs for method arguments. |
| public static interface | MvcUriComponentsBuilder.
Method invocation information. |
| Modifier and Type | Field and Description |
|---|---|
| private final UriComponentsBuilder | |
| private static final CompositeUriComponentsContributor | |
| private static final Log | |
| public static final String | MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME
Well-known name for the |
| private static final SpringObjenesis | |
| private static final ParameterNameDiscoverer | |
| private static final PathMatcher |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private static UriComponentsBuilder | |
| public static <T> T | |
| public static UriComponentsBuilder | Returns: a UriComponentsBuilder instance (nevernull)the controller to build a URI for controllerType)Create a |
| public static UriComponentsBuilder | Returns: a UriComponentsBuilder instance (nevernull)the builder for the base URL; the builder will be cloned
and therefore not modified and may be re-used for further calls. builder, Class<?> the controller to build a URI for controllerType)An alternative to |
| public static MvcUriComponentsBuilder. | Returns: a builder to prepare the URI Stringthe mapping name mappingName)Create a URL from the name of a Spring MVC controller method's request mapping. |
| public static MvcUriComponentsBuilder. | Returns: a builder to prepare the URI Stringthe builder for the base URL; the builder will be cloned
and therefore not modified and may be re-used for further calls. builder, String the mapping name name)An alternative to |
| public static UriComponentsBuilder | Returns: a UriComponentsBuilder instance, nevernullthe controller type controllerType, Method the controller method method, Object... argument values for the controller method args)Create a |
| public static UriComponentsBuilder | Returns: a UriComponentsBuilder instance (nevernull)the builder for the base URL; the builder will be cloned
and therefore not modified and may be re-used for further calls. baseUrl, Class<?> the controller type controllerType, Method the controller method method, Object... argument values for the controller method args)An alternative to |
| public static UriComponentsBuilder | Returns: a UriComponents instanceeither the value returned from a "mock" controller
invocation or the "mock" controller itself after an invocation info)Create a |
| public static UriComponentsBuilder | Returns: a UriComponents instancethe builder for the base URL; the builder will be cloned
and therefore not modified and may be re-used for further calls. builder, Object either the value returned from a "mock" controller
invocation or the "mock" controller itself after an invocation info)An alternative to |
| private static UriComponentsBuilder | fromMethodInternal(UriComponentsBuilder builder, Class<?> controllerType, Method method, Object... args)
|
| public static UriComponentsBuilder | Returns: a UriComponentsBuilder instance, nevernullthe controller controllerType, String the method name methodName, Object... the argument values args)Create a |
| public static UriComponentsBuilder | Returns: a UriComponentsBuilder instance, nevernullthe builder for the base URL; the builder will be cloned
and therefore not modified and may be re-used for further calls. builder, Class<?> the controller controllerType, String the method name methodName, Object... the argument values args)An alternative to |
| private static UriComponentsBuilder | |
| private static String | |
| private static Method | |
| private static String | |
| private static String | |
| private static String | |
| private static CompositeUriComponentsContributor | |
| private static WebApplicationContext | |
| public static <T> T | |
| public static MvcUriComponentsBuilder | |
| private static String | |
| public UriComponentsBuilder | withController(Class<?> controllerType)
An alternative to |
| public MvcUriComponentsBuilder. | withMappingName(String mappingName)
An alternative to |
| public UriComponentsBuilder | withMethod(Class<?> controllerType, Method method, Object... args)
An alternative to |
| public UriComponentsBuilder | withMethodCall(Object invocationInfo)
An alternative to |
| public UriComponentsBuilder | withMethodName(Class<?> controllerType, String methodName, Object... args)
An alternative to |