@Override public List<URI> getChildren(URI resource) { try (final FcrepoResponse response = client.get(resource) .accept("application/n-triples") .preferRepresentation(asList(PREFER_CONTAINMENT), emptyList()).perform()) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getBody(), UTF_8))) { final List<URI> children = new ArrayList<>(); for (String line = reader.readLine(); line != null; line = reader.readLine()) { final Matcher aclFinder = childPattern.matcher(line); if (aclFinder.matches()) { children.add(URI.create(aclFinder.group(1))); } } return children; } } catch (final Exception e) { throw new RuntimeException("Error getting children of " + resource, e); } } }
@Override public List<URI> getChildren(URI resource) { try (final FcrepoResponse response = client.get(resource) .accept("application/n-triples") .preferRepresentation(asList(PREFER_CONTAINMENT), emptyList()).perform()) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(response.getBody(), UTF_8))) { final List<URI> children = new ArrayList<>(); for (String line = reader.readLine(); line != null; line = reader.readLine()) { final Matcher aclFinder = childPattern.matcher(line); if (aclFinder.matches()) { children.add(URI.create(aclFinder.group(1))); } } return children; } } catch (final Exception e) { throw new RuntimeException("Error getting children of " + resource, e); } } }
/** * @param containerURI URI * @return resources * @throws ModellerClientFailedException Throwable */ public static String doGetContainerResources(final URI containerURI) throws ModellerClientFailedException { final FcrepoClient testClient; testClient = FcrepoClient.client().throwExceptionOnFailure().build(); try (FcrepoResponse response = testClient.get(containerURI).accept("text/turtle").perform()) { return IOUtils.toString(response.getBody(), "UTF-8"); } catch (FcrepoOperationFailedException e) { log.info(getMessage(e)); throw new ModellerClientFailedException(e); } catch (IOException e) { e.printStackTrace(); } return null; } }
case GET: default: final GetBuilder get = fcrepoClient.get(getUri(endpoint, url)).accept(accept); final String preferHeader = in.getHeader(FCREPO_PREFER, "", String.class); if (!preferHeader.isEmpty()) {