public class JsonPathLinkDiscoverer extends Object implements LinkDiscoverer
LinkDiscoverer
that uses JsonPath
to find links inside a representation.Constructor and Description |
---|
JsonPathLinkDiscoverer(String pathTemplate,
org.springframework.http.MediaType mediaType)
Creates a new
JsonPathLinkDiscoverer using the given path template supporting the given MediaType . |
Modifier and Type | Method and Description |
---|---|
List<Link> |
findLinksWithRel(String rel,
InputStream representation)
Returns all links with the given relation type found in the given
InputStream representation. |
List<Link> |
findLinksWithRel(String rel,
String representation)
Returns all links with the given relation type found in the given
String representation. |
Link |
findLinkWithRel(String rel,
InputStream representation)
Finds a single link with the given relation type in the given
InputStream representation. |
Link |
findLinkWithRel(String rel,
String representation)
Finds a single link with the given relation type in the given
String representation. |
boolean |
supports(org.springframework.http.MediaType delimiter) |
public JsonPathLinkDiscoverer(String pathTemplate, org.springframework.http.MediaType mediaType)
JsonPathLinkDiscoverer
using the given path template supporting the given MediaType
.
The template has to contain a single %s
placeholder which will be replaced by the relation type.pathTemplate
- must not be null or empty and contain a single placeholder.mediaType
- the MediaType
to support.public Link findLinkWithRel(String rel, String representation)
LinkDiscoverer
String
representation.findLinkWithRel
in interface LinkDiscoverer
rel
- must not be null or empty.representation
- must not be null or empty.public Link findLinkWithRel(String rel, InputStream representation)
LinkDiscoverer
InputStream
representation.findLinkWithRel
in interface LinkDiscoverer
rel
- must not be null or empty.representation
- must not be null or empty.public List<Link> findLinksWithRel(String rel, String representation)
LinkDiscoverer
String
representation.findLinksWithRel
in interface LinkDiscoverer
rel
- must not be null or empty.representation
- must not be null or empty.public List<Link> findLinksWithRel(String rel, InputStream representation)
LinkDiscoverer
InputStream
representation.findLinksWithRel
in interface LinkDiscoverer
rel
- must not be null or empty.representation
- must not be null or empty.public boolean supports(org.springframework.http.MediaType delimiter)
supports
in interface org.springframework.plugin.core.Plugin<org.springframework.http.MediaType>
Copyright © 2012-2014–2016 Pivotal, Inc.. All rights reserved.