/** * Make a PUT request to create a resource with a specified path, or replace the triples associated with a * resource with the triples provided in the request body. * * @param url the URL of the resource to which to PUT * @return a put request builder object */ public PutBuilder put(final URI url) { return new PutBuilder(url, this); }
/** * @param destinationURI URI * @param resourceFile File * @param contentType String * @throws ModellerClientFailedException Throwable */ public static void doBinaryPut(final URI destinationURI, final File resourceFile, final String contentType) throws ModellerClientFailedException { final FcrepoClient testClient; testClient = FcrepoClient.client().throwExceptionOnFailure().build(); try { final FcrepoResponse response = testClient.put(destinationURI).body(resourceFile, contentType).perform(); log.info(String.valueOf(response.getStatusCode())); } catch (FcrepoOperationFailedException e) { log.info(getMessage(e)); throw new ModellerClientFailedException(e); } catch (IOException e) { e.printStackTrace(); } }
/** * @param destinationURI URI * @throws ModellerClientFailedException Throwable */ public static void doPut(final URI destinationURI) throws ModellerClientFailedException { final FcrepoClient testClient; testClient = FcrepoClient.client().throwExceptionOnFailure().build(); try { final FcrepoResponse response = testClient.put(destinationURI).perform(); try { log.info(IOUtils.toString(response.getBody(), UTF_8)); } catch (IOException e) { log.info(getMessage(e)); } } catch (FcrepoOperationFailedException e) { log.info(getMessage(e)); throw new ModellerClientFailedException(e); } }
/** * @param destinationURI URI * @param resourceFile ByteArrayInputStream * @param contentType String * @throws ModellerClientFailedException Throwable */ public static void doStreamPut(final URI destinationURI, final ByteArrayInputStream resourceFile, final String contentType) throws ModellerClientFailedException { final FcrepoClient testClient; testClient = FcrepoClient.client().throwExceptionOnFailure().build(); try { final FcrepoResponse response = testClient.put(destinationURI).body(resourceFile, contentType).perform(); log.info(String.valueOf(response.getStatusCode())); } catch (FcrepoOperationFailedException e) { log.info(getMessage(e)); throw new ModellerClientFailedException(e); } }