@Test public void classpathLinkIsResolvedToContent() { URI schemaFile; JsonNode uriContent; schemaFile = URI.create("classpath:schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); schemaFile = URI.create("classpath:/schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); schemaFile = URI.create("resource:schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); schemaFile = URI.create("java:schema/address.json"); uriContent = resolver.resolve(schemaFile); assertThat(uriContent.path("description").asText().length(), is(greaterThan(0))); }
public JsonNode resolve(URI uri) { if (CLASSPATH_SCHEMES.contains(uri.getScheme())) { return resolveFromClasspath(uri); } try { return objectMapper.readTree(uri.toURL()); } catch (JsonProcessingException e) { throw new IllegalArgumentException("Error parsing document: " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Unrecognised URI, can't resolve this: " + uri, e); } }
ContentResolver { public JsonNode resolve(URI uri) { if (CLASSPATH_SCHEMES.contains(uri.getScheme())) { return resolveFromClasspath(uri); } try { return objectMapper.readTree(uri.toURL()); } catch (JsonProcessingException e) { throw new IllegalArgumentException("Error parsing document: " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Unrecognised URI, can't resolve this: " + uri, e); } } }
ContentResolver { public JsonNode resolve(URI uri) { if (CLASSPATH_SCHEMES.contains(uri.getScheme())) { return resolveFromClasspath(uri); } try { return objectMapper.readTree(uri.toURL()); } catch (JsonProcessingException e) { throw new IllegalArgumentException("Error parsing document: " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Unrecognised URI, can't resolve this: " + uri, e); } } ContentResolver();  ContentResolver(JsonFactory jsonFactory); }
ContentResolver { public JsonNode resolve(URI uri) { if (CLASSPATH_SCHEMES.contains(uri.getScheme())) { return resolveFromClasspath(uri); } try { return objectMapper.readTree(uri.toURL()); } catch (JsonProcessingException e) { throw new IllegalArgumentException("Error parsing document: " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Unrecognised URI, can't resolve this: " + uri, e); } } ContentResolver();  ContentResolver(JsonFactory jsonFactory); JsonNode resolve(URI uri); }
ContentResolver { public JsonNode resolve(URI uri) { if (CLASSPATH_SCHEMES.contains(uri.getScheme())) { return resolveFromClasspath(uri); } try { return objectMapper.readTree(uri.toURL()); } catch (JsonProcessingException e) { throw new IllegalArgumentException("Error parsing document: " + uri, e); } catch (IOException e) { throw new IllegalArgumentException("Unrecognised URI, can't resolve this: " + uri, e); } } ContentResolver();  ContentResolver(JsonFactory jsonFactory); JsonNode resolve(URI uri);  }