Package org.fcrepo.client
Class PostBuilder
- java.lang.Object
-
- org.fcrepo.client.RequestBuilder
-
- org.fcrepo.client.BodyRequestBuilder
-
- org.fcrepo.client.PostBuilder
-
- Direct Known Subclasses:
HistoricMementoBuilder
public class PostBuilder extends BodyRequestBuilder
Builds a post request for interacting with the Fedora HTTP API in order to create a new resource within an LDP container.- Author:
- bbpennel
-
-
Field Summary
-
Fields inherited from class org.fcrepo.client.RequestBuilder
client, request, targetUri
-
-
Constructor Summary
Constructors Constructor Description PostBuilder(URI uri, FcrepoClient client)Instantiate builder
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PostBuilderaddHeader(String name, String value)Add a header with the given name and value to the request.PostBuilderaddInteractionModel(String interactionModelUri)Add an interaction model to the requestPostBuilderaddLinkHeader(FcrepoLink linkHeader)Add a link header to the requestPostBuilderbody(File file, String contentType)Add the given file as the body for this request with the provided content typePostBuilderbody(InputStream stream)Add a body to this request from a stream, with application/octet-stream as its content typePostBuilderbody(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 builderPostBuilderdigest(String digest)Deprecated.PostBuilderdigest(String digest, String alg)Provide a checksum for the body of this requestPostBuilderdigestMd5(String digest)Provide a MD5 checksum for the body of this requestPostBuilderdigestSha1(String digest)Provide a SHA-1 checksum for the body of this request.PostBuilderdigestSha256(String digest)Provide a SHA-256 checksum for the body of this requestPostBuilderexternalContent(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.PostBuilderfilename(String filename)Provide a content disposition header which will be used as the filenamePostBuilderlinkAcl(String aclUri)Provide the URI to an ACL for this requestPostBuilderslug(String slug)Provide a suggested name for the new child resource, which the repository may ignore.-
Methods inherited from class org.fcrepo.client.BodyRequestBuilder
ifMatch, ifStateToken, ifUnmodifiedSince
-
Methods inherited from class org.fcrepo.client.RequestBuilder
perform
-
-
-
-
Constructor Detail
-
PostBuilder
public PostBuilder(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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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
@Deprecated public PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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 PostBuilder 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
-
-