Package org.mycore.restapi.v1.utils
Class MCRRestAPIUploadHelper
java.lang.Object
org.mycore.restapi.v1.utils.MCRRestAPIUploadHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.ws.rs.core.Response
deleteAllFiles
(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID) deletes all files inside a given derivatestatic jakarta.ws.rs.core.Response
deleteDerivate
(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID) deletes a whole derivatestatic String
serializes a map of Strings into a compact JSON structurestatic jakarta.ws.rs.core.Response
uploadDerivate
(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String label, String classifications, boolean overwriteOnExisting) creates or updates a MyCoRe derivatestatic jakarta.ws.rs.core.Response
uploadFile
(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails, String formParamPath, boolean formParamMaindoc, boolean formParamUnzip, String formParamMD5, Long formParamSize) uploads a file into a given derivatestatic jakarta.ws.rs.core.Response
uploadObject
(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails) uploads a MyCoRe Object based upon: http://puspendu.wordpress.com/2012/08/23/restful-webservice-file-upload-with-jersey/
-
Constructor Details
-
MCRRestAPIUploadHelper
public MCRRestAPIUploadHelper()
-
-
Method Details
-
uploadObject
public static jakarta.ws.rs.core.Response uploadObject(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails) throws MCRRestAPIException uploads a MyCoRe Object based upon: http://puspendu.wordpress.com/2012/08/23/restful-webservice-file-upload-with-jersey/- Parameters:
info
- - the Jersey UriInfo objectrequest
- - the HTTPServletRequest objectuploadedInputStream
- - the inputstream from HTTP Post requestfileDetails
- - the file information from HTTP Post request- Returns:
- a Jersey Response object
- Throws:
MCRRestAPIException
-
uploadDerivate
public static jakarta.ws.rs.core.Response uploadDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String label, String classifications, boolean overwriteOnExisting) throws MCRRestAPIException creates or updates a MyCoRe derivate- Parameters:
info
- - the Jersey UriInfo objectrequest
- - the HTTPServletRequest objectmcrObjID
- - the MyCoRe Object IDlabel
- - the label of the new derivateoverwriteOnExisting
- , if true, an existing MyCoRe derivate with the given label or classification will be returned- Returns:
- a Jersey Response object
- Throws:
MCRRestAPIException
-
uploadFile
public static jakarta.ws.rs.core.Response uploadFile(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails, String formParamPath, boolean formParamMaindoc, boolean formParamUnzip, String formParamMD5, Long formParamSize) throws MCRRestAPIException uploads a file into a given derivate- Parameters:
info
- - the Jersey UriInfo objectrequest
- - the HTTPServletRequest objectpathParamMcrObjID
- - a MyCoRe Object IDpathParamMcrDerID
- - a MyCoRe Derivate IDuploadedInputStream
- - the inputstream from HTTP Post requestfileDetails
- - the file information from HTTP Post requestformParamPath
- - the path of the file inside the derivateformParamMaindoc
- - true, if this file should be marked as maindocformParamUnzip
- - true, if the upload is zip file that should be unzipped inside the derivateformParamMD5
- - the MD5 sum of the uploaded fileformParamSize
- - the size of the uploaded file- Returns:
- a Jersey Response object
- Throws:
MCRRestAPIException
-
deleteAllFiles
public static jakarta.ws.rs.core.Response deleteAllFiles(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID) throws MCRRestAPIException deletes all files inside a given derivate- Parameters:
info
- - the Jersey UriInfo objectrequest
- - the HTTPServletRequest objectpathParamMcrObjID
- - the MyCoRe Object IDpathParamMcrDerID
- - the MyCoRe Derivate ID- Returns:
- a Jersey Response Object
- Throws:
MCRRestAPIException
-
deleteDerivate
public static jakarta.ws.rs.core.Response deleteDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID) throws MCRRestAPIException deletes a whole derivate- Parameters:
info
- - the Jersey UriInfo objectrequest
- - the HTTPServletRequest objectpathParamMcrObjID
- - the MyCoRe Object IDpathParamMcrDerID
- - the MyCoRe Derivate ID- Returns:
- a Jersey Response Object
- Throws:
MCRRestAPIException
-
generateMessagesFromProperties
serializes a map of Strings into a compact JSON structure- Parameters:
data
- a sorted Map of Strings- Returns:
- a compact JSON
-