public class FcrepoClient extends Object
Users of the FcrepoClient are responsible for managing connection resources. Specifically, the underlying
HTTP connections of this client must be freed. Suggested usage is to create the FcrepoResponse within
a try-with-resources block, insuring that any resources held by the response are freed automatically.
FcrepoClient client = ...;
try (FcrepoResponse res = client.get(...)) {
// do something with the response
} catch (FcrepoOperationFailedException|IOException e) {
// handle any exceptions
}
| Constructor and Description |
|---|
FcrepoClient(String username,
String password,
String host,
Boolean throwExceptionOnFailure)
Create a FcrepoClient with a set of authentication values.
|
| Modifier and Type | Method and Description |
|---|---|
FcrepoResponse |
delete(URI url)
Make a DELETE request
|
FcrepoResponse |
get(URI url,
String accept,
String prefer)
Make a GET request
|
FcrepoResponse |
head(URI url)
Make a HEAD response
|
FcrepoResponse |
patch(URI url,
InputStream body)
Make a PATCH request
Please note: the body should have an application/sparql-update content-type
|
FcrepoResponse |
post(URI url,
InputStream body,
String contentType)
Make a POST request
|
FcrepoResponse |
put(URI url,
InputStream body,
String contentType)
Make a PUT request
|
public FcrepoClient(String username, String password, String host, Boolean throwExceptionOnFailure)
username - the username for the repositorypassword - the password for the repositoryhost - the authentication hostname (realm) for the repositorythrowExceptionOnFailure - whether to throw an exception on any non-2xx or 3xx HTTP responsespublic FcrepoResponse head(URI url) throws FcrepoOperationFailedException
url - the URL of the resource to checkFcrepoOperationFailedException - when the underlying HTTP request results in an errorpublic FcrepoResponse put(URI url, InputStream body, String contentType) throws FcrepoOperationFailedException
url - the URL of the resource to PUTbody - the contents of the resource to sendcontentType - the MIMEType of the resourceFcrepoOperationFailedException - when the underlying HTTP request results in an errorpublic FcrepoResponse patch(URI url, InputStream body) throws FcrepoOperationFailedException
url - the URL of the resource to PATCHbody - the body to be sent to the repositoryFcrepoOperationFailedException - when the underlying HTTP request results in an errorpublic FcrepoResponse post(URI url, InputStream body, String contentType) throws FcrepoOperationFailedException
url - the URL of the resource to which to POSTbody - the content to be sent to the servercontentType - the Content-Type of the bodyFcrepoOperationFailedException - when the underlying HTTP request results in an errorpublic FcrepoResponse delete(URI url) throws FcrepoOperationFailedException
url - the URL of the resource to deleteFcrepoOperationFailedException - when the underlying HTTP request results in an errorpublic FcrepoResponse get(URI url, String accept, String prefer) throws FcrepoOperationFailedException
url - the URL of the resource to fetchaccept - the requested MIMEType of the resource to be retrievedprefer - the value for a prefer header sent in the requestFcrepoOperationFailedException - when the underlying HTTP request results in an errorCopyright © 2013-2016 DuraSpace, Inc.. All Rights Reserved.