Class StreamingMultipartRequestResolver
java.lang.Object
org.dataone.mimemultipart.MultipartRequestResolver
edu.ucsb.nceas.metacat.restservice.multipart.StreamingMultipartRequestResolver
public class StreamingMultipartRequestResolver
extends org.dataone.mimemultipart.MultipartRequestResolver
This class will stream the file parts of the multipart request into a temporary file.
During the streaming, the checksum of the tmp file will be calculated and maintained.
The temple file with the checksum can be moved to the permanent location
rather than copying (read/write). So we only need to read/write once and the
performance can be improved.
- Author:
- tao
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStreamingMultipartRequestResolver(String tmpUploadDir, int maxUploadSize) Constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeleteTempFile(File temp) Delete a temp file either immediately or on program exists according to the configurationorg.dataone.service.types.v1.SystemMetadataGet the system metadata object which was extracted from the sysmeta part.org.dataone.mimemultipart.MultipartRequestresolveMultipart(javax.servlet.http.HttpServletRequest request) Methods inherited from class org.dataone.mimemultipart.MultipartRequestResolver
isMultipartContent
-
Field Details
-
SYSMETA
- See Also:
-
-
Constructor Details
-
StreamingMultipartRequestResolver
Constructor- Parameters:
tmpUploadDir- the directory will temporarily host the stored files from the file parts in the http multiparts request.maxUploadSize- the threshold size of files which can be allowed to upload
-
-
Method Details
-
resolveMultipart
public org.dataone.mimemultipart.MultipartRequest resolveMultipart(javax.servlet.http.HttpServletRequest request) throws IOException, org.apache.commons.fileupload.FileUploadException, InstantiationException, IllegalAccessException, org.dataone.exceptions.MarshallingException, NoSuchAlgorithmException, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.ServiceFailure, RuntimeException, InterruptedException, InvocationTargetException - Overrides:
resolveMultipartin classorg.dataone.mimemultipart.MultipartRequestResolver- Throws:
IOExceptionorg.apache.commons.fileupload.FileUploadExceptionInstantiationExceptionIllegalAccessExceptionorg.dataone.exceptions.MarshallingExceptionNoSuchAlgorithmExceptionorg.dataone.service.exceptions.InvalidRequestorg.dataone.service.exceptions.InvalidSystemMetadataorg.dataone.service.exceptions.ServiceFailureRuntimeExceptionInterruptedExceptionInvocationTargetException
-
getSystemMetadataPart
public org.dataone.service.types.v1.SystemMetadata getSystemMetadataPart()Get the system metadata object which was extracted from the sysmeta part. The sysmeta wasn't stored in a file and was created an object directly. -
deleteTempFile
Delete a temp file either immediately or on program exists according to the configuration- Parameters:
temp- the file will be deleted
-