WebMvcLinkBuilder instead.@Deprecated public class ControllerLinkBuilder extends TemplateVariableAwareLinkBuilderSupport<ControllerLinkBuilder>
Link instances pointing to Spring MVC controllers.| Modifier and Type | Method and Description |
|---|---|
static Affordance |
afford(Object invocationValue)
Deprecated.
|
protected ControllerLinkBuilder |
createNewInstance(UriComponentsBuilder builder,
List<Affordance> affordances,
TemplateVariables variables)
Deprecated.
|
static UriComponentsBuilder |
getBuilder()
Deprecated.
Returns a
UriComponentsBuilder obtained from the current servlet mapping. |
protected ControllerLinkBuilder |
getThis()
Deprecated.
Returns the current concrete instance.
|
static ControllerLinkBuilder |
linkTo(Class<?> controller)
Deprecated.
Creates a new
ControllerLinkBuilder with a base of the mapping annotated to the given controller class. |
static ControllerLinkBuilder |
linkTo(Class<?> controller,
Map<String,?> parameters)
Deprecated.
Creates a new
ControllerLinkBuilder with a base of the mapping annotated to the given controller class. |
static ControllerLinkBuilder |
linkTo(Class<?> controller,
Method method,
Object... parameters)
Deprecated.
|
static ControllerLinkBuilder |
linkTo(Class<?> controller,
Object... parameters)
Deprecated.
Creates a new
ControllerLinkBuilder with a base of the mapping annotated to the given controller class. |
static ControllerLinkBuilder |
linkTo(Method method,
Object... parameters)
Deprecated.
|
static ControllerLinkBuilder |
linkTo(Object invocationValue)
Deprecated.
Creates a
ControllerLinkBuilder pointing to a controller method. |
static <T> T |
methodOn(Class<T> controller,
Object... parameters)
Deprecated.
Wrapper for
DummyInvocationUtils.methodOn(Class, Object...) to be available in case you work with static
imports of ControllerLinkBuilder. |
UriComponentsBuilder |
toUriComponentsBuilder()
Deprecated.
Returns a
UriComponentsBuilder to continue to build the already built URI in a more fine grained way. |
createNewInstance, toStringaddAffordances, slash, slash, toUri, withFreshBuilder, withRel, withSelfRelclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitwithRelpublic static ControllerLinkBuilder linkTo(Class<?> controller)
ControllerLinkBuilder with a base of the mapping annotated to the given controller class.controller - the class to discover the annotation on, must not be null.public static ControllerLinkBuilder linkTo(Class<?> controller, Object... parameters)
ControllerLinkBuilder with a base of the mapping annotated to the given controller class. The
additional parameters are used to fill up potentially available path variables in the class scop request mapping.controller - the class to discover the annotation on, must not be null.parameters - additional parameters to bind to the URI template declared in the annotation, must not be
null.public static ControllerLinkBuilder linkTo(Class<?> controller, Map<String,?> parameters)
ControllerLinkBuilder with a base of the mapping annotated to the given controller class.
Parameter map is used to fill up potentially available path variables in the class scope request mapping.controller - the class to discover the annotation on, must not be null.parameters - additional parameters to bind to the URI template declared in the annotation, must not be
null.public static ControllerLinkBuilder linkTo(Method method, Object... parameters)
public static ControllerLinkBuilder linkTo(Class<?> controller, Method method, Object... parameters)
public static ControllerLinkBuilder linkTo(Object invocationValue)
ControllerLinkBuilder pointing to a controller method. Hand in a dummy method invocation result
you can create via methodOn(Class, Object...) or DummyInvocationUtils.methodOn(Class, Object...).
@RequestMapping("/customers")
class CustomerController {
@RequestMapping("/{id}/addresses")
HttpEntity<Addresses> showAddresses(@PathVariable Long id) { … }
}
Link link = linkTo(methodOn(CustomerController.class).showAddresses(2L)).withRel("addresses");
The resulting Link instance will point to /customers/2/addresses and have a rel of
addresses. For more details on the method invocation constraints, see
DummyInvocationUtils.methodOn(Class, Object...).invocationValue - public static Affordance afford(Object invocationValue)
Link from the ControllerLinkBuilder and look up the related Affordance. Should
only be one.
Link findOneLink = linkTo(methodOn(EmployeeController.class).findOne(id)).withSelfRel()
.andAffordance(afford(methodOn(EmployeeController.class).updateEmployee(null, id)));
This takes a link and adds an Affordance based on another Spring MVC handler method.invocationValue - public static <T> T methodOn(Class<T> controller, Object... parameters)
DummyInvocationUtils.methodOn(Class, Object...) to be available in case you work with static
imports of ControllerLinkBuilder.controller - must not be null.parameters - parameters to extend template variables in the type level mapping.protected ControllerLinkBuilder getThis()
LinkBuilderSupportgetThis in class LinkBuilderSupport<ControllerLinkBuilder>protected ControllerLinkBuilder createNewInstance(UriComponentsBuilder builder, List<Affordance> affordances, TemplateVariables variables)
createNewInstance in class TemplateVariableAwareLinkBuilderSupport<ControllerLinkBuilder>public UriComponentsBuilder toUriComponentsBuilder()
UriComponentsBuilder to continue to build the already built URI in a more fine grained way.public static UriComponentsBuilder getBuilder()
UriComponentsBuilder obtained from the current servlet mapping. If no
RequestContextHolder exists (you're outside a Spring Web call), fall back to relative URIs.Copyright © 2012-2019–2019 Pivotal, Inc.. All rights reserved.