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
Modifier and TypeClassDescriptionclass
Builder API to customize traversals. -
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionSets up aTraverson.TraversalBuilder
to follow the given rels.Sets up aTraverson.TraversalBuilder
for a single rel with customized details.static List<HttpMessageConverter<?>>
getDefaultMessageConverters
(MediaType... mediaTypes) Returns allHttpMessageConverter
s that will be registered for the givenMediaType
s by default.setLinkDiscoverers
(List<? extends LinkDiscoverer> discoverer) Sets theLinkDiscoverers
to use.setRestOperations
(RestOperations operations) Configures theRestOperations
to use.
-
Constructor Details
-
Traverson
Creates a newTraverson
interacting with the given base URI and using the givenMediaType
s to interact with the service.- Parameters:
baseUri
- must not be null.mediaTypes
- must not be null or empty.
-
Traverson
Creates a newTraverson
interacting with the given base URI and using the givenMediaType
s to interact with the service.- Parameters:
baseUri
- must not be null.mediaTypes
- must not be null or empty.
-
-
Method Details
-
getDefaultMessageConverters
Returns allHttpMessageConverter
s that will be registered for the givenMediaType
s by default.- Parameters:
mediaTypes
- must not be null.- Returns:
-
setRestOperations
Configures theRestOperations
to use. If null is provided a defaultRestTemplate
will be used.- Parameters:
operations
-- Returns:
-
setLinkDiscoverers
Sets theLinkDiscoverers
to use. By default a singleHalLinkDiscoverer
is registered. If null is provided the default is reapplied.- Parameters:
discoverer
- can be null.- Returns:
-
follow
Sets up aTraverson.TraversalBuilder
to follow the given rels.- Parameters:
rels
- must not be null or empty.- Returns:
- See Also:
-
follow
Sets up aTraverson.TraversalBuilder
for a single rel with customized details.- Parameters:
hop
- must not be null- Returns:
-