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
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    StreamingMultipartRequestResolver(String tmpUploadDir, int maxUploadSize)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Delete a temp file either immediately or on program exists according to the configuration
    org.dataone.service.types.v1.SystemMetadata
    Get the system metadata object which was extracted from the sysmeta part.
    org.dataone.mimemultipart.MultipartRequest
    resolveMultipart(javax.servlet.http.HttpServletRequest request)
     

    Methods inherited from class org.dataone.mimemultipart.MultipartRequestResolver

    isMultipartContent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • StreamingMultipartRequestResolver

      public StreamingMultipartRequestResolver(String tmpUploadDir, int maxUploadSize)
      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:
      resolveMultipart in class org.dataone.mimemultipart.MultipartRequestResolver
      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
    • 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

      public static void deleteTempFile(File temp)
      Delete a temp file either immediately or on program exists according to the configuration
      Parameters:
      temp - the file will be deleted