Package org.fcrepo.client
Class HistoricMementoBuilder
- java.lang.Object
-
- org.fcrepo.client.RequestBuilder
-
- org.fcrepo.client.BodyRequestBuilder
-
- org.fcrepo.client.HistoricMementoBuilder
-
public class HistoricMementoBuilder extends BodyRequestBuilder
Builds a POST request for creating a memento (LDPRm) with the state given in the request body and the datetime given in the Memento-Datetime request header.- Author:
- bbpennel
-
-
Field Summary
-
Fields inherited from class org.fcrepo.client.RequestBuilder
client, request, targetUri
-
-
Constructor Summary
Constructors Constructor Description HistoricMementoBuilder(URI uri, FcrepoClient client, String mementoDatetime)Instantiate builder.HistoricMementoBuilder(URI uri, FcrepoClient client, Instant mementoInstant)Instantiate builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HistoricMementoBuilderaddHeader(String name, String value)Add a header with the given name and value to the request.HistoricMementoBuilderaddInteractionModel(String interactionModelUri)Add an interaction model to the requestHistoricMementoBuilderaddLinkHeader(FcrepoLink linkHeader)Add a link header to the requestHistoricMementoBuilderbody(File file, String contentType)Add the given file as the body for this request with the provided content typeHistoricMementoBuilderbody(InputStream stream)Add a body to this request from a stream, with application/octet-stream as its content typeHistoricMementoBuilderbody(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 builderHistoricMementoBuilderdigest(String digest, String alg)Provide a checksum for the body of this requestHistoricMementoBuilderdigestMd5(String digest)Provide a MD5 checksum for the body of this requestHistoricMementoBuilderdigestSha1(String digest)Provide a SHA-1 checksum for the body of this request.HistoricMementoBuilderdigestSha256(String digest)Provide a SHA-256 checksum for the body of this requestHistoricMementoBuilderexternalContent(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.HistoricMementoBuilderfilename(String filename)Provide a content disposition header which will be used as the filenameHistoricMementoBuilderlinkAcl(String aclUri)Provide the URI to an ACL for this requestHistoricMementoBuilderslug(String slug)Provide a suggested name for the new child resource, which the repository may ignore.-
Methods inherited from class org.fcrepo.client.BodyRequestBuilder
digest, ifMatch, ifStateToken, ifUnmodifiedSince
-
Methods inherited from class org.fcrepo.client.RequestBuilder
addTransaction, perform
-
-
-
-
Constructor Detail
-
HistoricMementoBuilder
public HistoricMementoBuilder(URI uri, FcrepoClient client, Instant mementoInstant)
Instantiate builder- Parameters:
uri- uri of the resource this request is being made toclient- the clientmementoInstant- Instant to use for the memento-datetime
-
HistoricMementoBuilder
public HistoricMementoBuilder(URI uri, FcrepoClient client, String mementoDatetime)
Instantiate builder.- Parameters:
uri- uri of the resource this request is being made toclient- the clientmementoDatetime- RFC1123 formatted date to use for the memento-datetime
-
-
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 HistoricMementoBuilder 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 HistoricMementoBuilder 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
-
body
public HistoricMementoBuilder 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
-
externalContent
public HistoricMementoBuilder 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
-
digest
public HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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 HistoricMementoBuilder 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
-
slug
public HistoricMementoBuilder slug(String slug)
Provide a suggested name for the new child resource, which the repository may ignore.- Parameters:
slug- value to supply as the slug header- Returns:
- this builder
-
-