@Test public void localURL() throws URISyntaxException, IOException { URL url = getClass().getResource("/META-INF/MANIFEST.MF"); URI uri = url.toURI(); assertThat(uri.getScheme(), is("jar")); String manifest = TermLookupServiceImpl.contentToString(uri); assertThat(manifest, is(notNullValue())); }
protected static String contentToString(URI uri) throws IOException { String response; if ("file".equals(uri.getScheme()) || "jar".equals(uri.getScheme())) { response = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8); } else { response = HttpUtil.getContent(uri); } return response; }
TermLookupServiceImpl implements TermLookupService { protected static String contentToString(URI uri) throws IOException { String response; if ("file".equals(uri.getScheme()) || "jar".equals(uri.getScheme())) { response = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8); } else { response = HttpUtil.getContent(uri); } return response; } }
TermLookupServiceImpl implements TermLookupService { protected static String contentToString(URI uri) throws IOException { String response; if ("file".equals(uri.getScheme()) || "jar".equals(uri.getScheme())) { response = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8); } else { response = HttpUtil.getContent(uri); } return response; }  }
TermLookupServiceImpl implements TermLookupService { protected static String contentToString(URI uri) throws IOException { String response; if ("file".equals(uri.getScheme()) || "jar".equals(uri.getScheme())) { response = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8); } else { response = HttpUtil.getContent(uri); } return response; }  @Override List<Term> lookupTermByName(final String name); void shutdown(); }
TermLookupServiceImpl implements TermLookupService { protected static String contentToString(URI uri) throws IOException { String response; if ("file".equals(uri.getScheme()) || "jar".equals(uri.getScheme())) { response = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8); } else { response = HttpUtil.getContent(uri); } return response; }  @Override List<Term> lookupTermByName(final String name); void shutdown();  }