Package org.fcrepo.client
Class PutBuilder
- java.lang.Object
-
- org.fcrepo.client.RequestBuilder
-
- org.fcrepo.client.BodyRequestBuilder
-
- org.fcrepo.client.PutBuilder
-
public class PutBuilder extends BodyRequestBuilder
Builds a PUT request for interacting with the Fedora HTTP API in order to create a resource with a specified path, or replace the triples associated with a resource with the triples provided in the request body.- Author:
- bbpennel
-
-
Field Summary
-
Fields inherited from class org.fcrepo.client.RequestBuilder
client, request, targetUri
-
-
Constructor Summary
Constructors Constructor Description PutBuilder(URI uri, FcrepoClient client)Instantiate builder
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PutBuilderaddHeader(String name, String value)Add a header with the given name and value to the request.PutBuilderaddInteractionModel(String interactionModelUri)Add an interaction model to the requestPutBuilderaddLinkHeader(FcrepoLink linkHeader)Add a link header to the requestPutBuilderbody(File file, String contentType)Add the given file as the body for this request with the provided content typePutBuilderbody(InputStream stream)Add a body to this request from a stream, with application/octet-stream as its content typePutBuilderbody(InputStream stream, String contentType)Add a body to this request as a stream with the given content typeprotected org.apache.http.client.methods.HttpRequestBasecreateRequest()Creates the HTTP request object for this builderPutBuilderdigest(String digest)Deprecated.PutBuilderdigest(String digest, String alg)Provide a checksum for the body of this requestPutBuilderdigestMd5(String digest)Provide a MD5 checksum for the body of this requestPutBuilderdigestSha1(String digest)Provide a SHA-1 checksum for the body of this request.PutBuilderdigestSha256(String digest)Provide a SHA-256 checksum for the body of this requestPutBuilderexternalContent(URI contentURI, String contentType, String handling)Add the given URI to the request as the location a Non-RDF Source binary should use for external content.PutBuilderfilename(String filename)Provide a content disposition header which will be used as the filenamePutBuilderifMatch(String etag)Provide an etag for the if-match header for this requestPutBuilderifStateToken(String token)Provide a value for the if-state-token header for this request.PutBuilderifUnmodifiedSince(String modified)Provide a if-unmodified-since header for this requestPutBuilderlinkAcl(String aclUri)Provide the URI to an ACL for this requestPutBuilderpreferLenient()Set the prefer header for this request to lenient handling, to indicate that server-managed triples will not be included in the request body.-
Methods inherited from class org.fcrepo.client.RequestBuilder
perform
-
-
-
-
Constructor Detail
-
PutBuilder
public PutBuilder(URI uri, FcrepoClient client)
Instantiate builder- Parameters:
uri- uri of the resource this request is being made toclient- the client
-
-
Method Detail
-
createRequest
protected org.apache.http.client.methods.HttpRequestBase createRequest()
Description copied from class:RequestBuilderCreates the HTTP request object for this builder- Specified by:
createRequestin classRequestBuilder- Returns:
- HTTP request object for this builder
-
body
public PutBuilder body(InputStream stream, String contentType)
Description copied from class:BodyRequestBuilderAdd a body to this request as a stream with the given content type- Overrides:
bodyin classBodyRequestBuilder- Parameters:
stream- InputStream of the content to be sent to the servercontentType- the Content-Type of the body- Returns:
- this builder
-
body
public PutBuilder body(File file, String contentType) throws IOException
Description copied from class:BodyRequestBuilderAdd the given file as the body for this request with the provided content type- Overrides:
bodyin classBodyRequestBuilder- Parameters:
file- File containing the content to be sent to the servercontentType- the Content-Type of the body- Returns:
- this builder
- Throws:
IOException- when unable to stream the body file
-
externalContent
public PutBuilder externalContent(URI contentURI, String contentType, String handling)
Description copied from class:BodyRequestBuilderAdd the given URI to the request as the location a Non-RDF Source binary should use for external content. The handling parameter must be supplied, and informs the server of how to process the request.- Overrides:
externalContentin classBodyRequestBuilder- Parameters:
contentURI- URI of the external content.contentType- Mimetype to supply for the external content.handling- Name of the handling method, used by the server to determine how to process the external content URI. Standard values can be found inExternalContentHandling.- Returns:
- this builder
-
body
public PutBuilder body(InputStream stream)
Description copied from class:BodyRequestBuilderAdd a body to this request from a stream, with application/octet-stream as its content type- Overrides:
bodyin classBodyRequestBuilder- Parameters:
stream- InputStream of the content to be sent to the server- Returns:
- this builder
-
ifMatch
public PutBuilder ifMatch(String etag)
Description copied from class:BodyRequestBuilderProvide an etag for the if-match header for this request- Overrides:
ifMatchin classBodyRequestBuilder- Parameters:
etag- etag to provide as the if-match header- Returns:
- this builder
-
ifUnmodifiedSince
public PutBuilder ifUnmodifiedSince(String modified)
Description copied from class:BodyRequestBuilderProvide a if-unmodified-since header for this request- Overrides:
ifUnmodifiedSincein classBodyRequestBuilder- Parameters:
modified- date to provide as the if-unmodified-since header- Returns:
- this builder
-
ifStateToken
public PutBuilder ifStateToken(String token)
Description copied from class:BodyRequestBuilderProvide a value for the if-state-token header for this request.- Overrides:
ifStateTokenin classBodyRequestBuilder- Parameters:
token- state token value- Returns:
- this builder
-
digest
@Deprecated public PutBuilder digest(String digest)
Deprecated.Description copied from class:BodyRequestBuilderProvide a SHA-1 checksum for the body of this request.- Overrides:
digestin classBodyRequestBuilder- Parameters:
digest- sha-1 checksum to provide as the digest for the request body- Returns:
- this builder
-
digest
public PutBuilder digest(String digest, String alg)
Description copied from class:BodyRequestBuilderProvide a checksum for the body of this request- Overrides:
digestin classBodyRequestBuilder- Parameters:
digest- checksum to provide as the digest for the request bodyalg- abbreviated algorithm identifier for the type of checksum being added (for example, sha1, md5, etc)- Returns:
- this builder
-
digestMd5
public PutBuilder digestMd5(String digest)
Description copied from class:BodyRequestBuilderProvide a MD5 checksum for the body of this request- Overrides:
digestMd5in classBodyRequestBuilder- Parameters:
digest- MD5 checksum to provide as the digest for the request body- Returns:
- this builder
-
digestSha1
public PutBuilder digestSha1(String digest)
Description copied from class:BodyRequestBuilderProvide a SHA-1 checksum for the body of this request.- Overrides:
digestSha1in classBodyRequestBuilder- Parameters:
digest- sha-1 checksum to provide as the digest for the request body- Returns:
- this builder
-
digestSha256
public PutBuilder digestSha256(String digest)
Description copied from class:BodyRequestBuilderProvide a SHA-256 checksum for the body of this request- Overrides:
digestSha256in classBodyRequestBuilder- Parameters:
digest- sha-256 checksum to provide as the digest for the request body- Returns:
- this builder
-
addInteractionModel
public PutBuilder addInteractionModel(String interactionModelUri)
Description copied from class:BodyRequestBuilderAdd an interaction model to the request- Overrides:
addInteractionModelin classBodyRequestBuilder- Parameters:
interactionModelUri- URI of the interaction model- Returns:
- this builder
-
linkAcl
public PutBuilder linkAcl(String aclUri)
Description copied from class:BodyRequestBuilderProvide the URI to an ACL for this request- Overrides:
linkAclin classBodyRequestBuilder- Parameters:
aclUri- URI to the ACL- Returns:
- this builder
-
addHeader
public PutBuilder addHeader(String name, String value)
Description copied from class:RequestBuilderAdd a header with the given name and value to the request.- Overrides:
addHeaderin classRequestBuilder- Parameters:
name- name of the headervalue- value of the header- Returns:
- this builder
-
addLinkHeader
public PutBuilder addLinkHeader(FcrepoLink linkHeader)
Description copied from class:RequestBuilderAdd a link header to the request- Overrides:
addLinkHeaderin classRequestBuilder- Parameters:
linkHeader- link header value represented as a FcrepoLink- Returns:
- this builder
-
filename
public PutBuilder filename(String filename) throws FcrepoOperationFailedException
Provide a content disposition header which will be used as the filename- Parameters:
filename- the name of the file being provided in the body of the request- Returns:
- this builder
- Throws:
FcrepoOperationFailedException- if unable to encode filename
-
preferLenient
public PutBuilder preferLenient()
Set the prefer header for this request to lenient handling, to indicate that server-managed triples will not be included in the request body.- Returns:
- this builder
-
-