public final class URIManager extends Object
This uses a map of URIDownloader
instances to fetch the contents
of a URI as an InputStream
, then tries and turns this content into
JSON using an ObjectMapper
.
Normally, you will never use this class directly.
SchemaRegistry
,
JsonLoader
Constructor and Description |
---|
URIManager() |
Modifier and Type | Method and Description |
---|---|
void |
addRedirection(String from,
String to)
Add a URI rediction
|
JsonNode |
getContent(URI uri)
Get the content at a given URI as a
JsonNode |
void |
registerScheme(String scheme,
URIDownloader downloader)
Register a new downloader for a given URI scheme
|
void |
unregisterScheme(String scheme)
Unregister a downloader for a given scheme
|
public void registerScheme(String scheme, URIDownloader downloader)
scheme
- the schemedownloader
- the URIDownloader
instanceNullPointerException
- scheme is nullIllegalArgumentException
- scheme is empty, or is already
registeredpublic void unregisterScheme(String scheme)
scheme
- the schemeNullPointerException
- scheme is nullpublic void addRedirection(String from, String to)
The typical use case for this is if you have a local copy of a schema whose id is normally unreachable. You can transform all references to this schema's URI to another URI which is reachable by your application.
Note that the given strings will be considered as JSON References, and that both arguments must be valid absolute JSON References. For the recall, there is more to it than URIs being absolute: their fragment part must also be empty or null.
from
- the original URIto
- an URI which is reachableNullPointerException
- from
or to
is nullIllegalArgumentException
- either from
or to
are
invalid URIs, or are not absolute JSON Referencespublic JsonNode getContent(URI uri) throws ProcessingException
JsonNode
uri
- the URIProcessingException
- scheme is not registered, failed to get
content, or content is not JSONCopyright © 2013. All Rights Reserved.