/** * Retrieve the resource location from a HEAD request. */ private URI getMetadataUri(final String url) throws FcrepoOperationFailedException { final FcrepoResponse headResponse = fcrepoClient.head(URI.create(url)).perform(); if (headResponse.getLocation() != null) { return headResponse.getLocation(); } else { return URI.create(url); } }
@Override protected void doBegin(final Object transaction, final TransactionDefinition definition) { final FcrepoResponse response; final InputStream is = null; final String contentType = null; final FcrepoTransactionObject tx = (FcrepoTransactionObject)transaction; if (tx.getSessionId() == null) { try { response = getClient().post(URI.create(baseUrl + TRANSACTION)) .body(is, contentType).perform(); } catch (final FcrepoOperationFailedException ex) { LOGGER.debug("HTTP Operation failed: ", ex); throw new CannotCreateTransactionException("Could not create fcrepo transaction"); } if (response != null && response.getLocation() != null) { tx.setSessionId(response.getLocation().toString().substring(baseUrl.length() + 1)); } else { throw new CannotCreateTransactionException("Invalid response while creating transaction"); } } }
return response.getLocation(); } catch (Exception e) { throw new RuntimeException("An problem occurred while POSTing binary content to Resource " +
return response.getLocation(); } catch (Exception e) { throw new RuntimeException("An problem occurred while POSTing binary content to Resource " +