Class Traverson
java.lang.Object
org.springframework.hateoas.client.Traverson
Component to ease traversing hypermedia APIs by following links with relation types. Highly inspired by the equally
named JavaScript library.
- Since:
- 0.11
- Author:
- Oliver Gierke, Dietrich Schulten, Greg Turnquist, Tom Bunting, Manish Misra, Michael Wirth
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassBuilder API to customize traversals. -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionSets up aTraverson.TraversalBuilderto follow the given rels.Sets up aTraverson.TraversalBuilderfor a single rel with customized details.static List<HttpMessageConverter<?>>getDefaultMessageConverters(MediaType... mediaTypes) Returns allHttpMessageConverters that will be registered for the givenMediaTypes by default.setLinkDiscoverers(List<? extends LinkDiscoverer> discoverer) Sets theLinkDiscoverersto use.setRestOperations(RestOperations operations) Configures theRestOperationsto use.
-
Constructor Details
-
Traverson
Creates a newTraversoninteracting with the given base URI and using the givenMediaTypes to interact with the service.- Parameters:
baseUri- must not be null.mediaTypes- must not be null or empty.
-
Traverson
Creates a newTraversoninteracting with the given base URI and using the givenMediaTypes to interact with the service.- Parameters:
baseUri- must not be null.mediaTypes- must not be null or empty.
-
-
Method Details
-
getDefaultMessageConverters
Returns allHttpMessageConverters that will be registered for the givenMediaTypes by default.- Parameters:
mediaTypes- must not be null.- Returns:
-
setRestOperations
Configures theRestOperationsto use. If null is provided a defaultRestTemplatewill be used.- Parameters:
operations-- Returns:
-
setLinkDiscoverers
Sets theLinkDiscoverersto use. By default a singleHalLinkDiscovereris registered. If null is provided the default is reapplied.- Parameters:
discoverer- can be null.- Returns:
-
follow
Sets up aTraverson.TraversalBuilderto follow the given rels.- Parameters:
rels- must not be null or empty.- Returns:
- See Also:
-
follow
Sets up aTraverson.TraversalBuilderfor a single rel with customized details.- Parameters:
hop- must not be null- Returns:
-