Class UnzipUploadManager


  • public class UnzipUploadManager
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CTXT_DOC_UNZIP_REQUESTED
      DataController's context map key to use in order to enabled or disable automatic unzip of FileDocument during their creation.
      static java.lang.String REVISION  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean canUnzipToFileDocuments()
      Checks if unzipping of one ZipEntry to n FileDocuments is allowed.
      static void clearUnzippingState​(javax.servlet.http.HttpServletRequest request)
      Clear the request attribute indicating that an unzipping operation is in progress.
      static java.io.File getZipDirectoryAttribute​(javax.servlet.http.HttpServletRequest request, java.lang.String filename)
      Retrieve the temporarty unzip directory of the specified filename
      static boolean isUnzippingInProgress​(javax.servlet.http.HttpServletRequest request)
      Checks if an unzipping is already being performed.
      static void removeZipDirectoryAttribute​(javax.servlet.http.HttpServletRequest request, java.lang.String filename)
      Remove the temporarty unzip directory of the specified filename from the request attibutes.
      static void setUnzippingState​(javax.servlet.http.HttpServletRequest request)
      Set a request attribute indicating that an unzipping operation is in progress.
      static void setZipDirectoryAttribute​(javax.servlet.http.HttpServletRequest request, java.lang.String filename, java.io.File tmpDir)
      Store temporary unzip directory of the specified filename in the the request attribute.
      • Methods inherited from class java.lang.Object

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

      • CTXT_DOC_UNZIP_REQUESTED

        public static java.lang.String CTXT_DOC_UNZIP_REQUESTED
        DataController's context map key to use in order to enabled or disable automatic unzip of FileDocument during their creation. Value in context map is a Boolean.
        Since:
        jcms-5.7.3
    • Constructor Detail

      • UnzipUploadManager

        public UnzipUploadManager()
    • Method Detail

      • canUnzipToFileDocuments

        public static boolean canUnzipToFileDocuments()
        Checks if unzipping of one ZipEntry to n FileDocuments is allowed.

        Current implementation checks property "file-document.allow-unzip".

        Returns:
        true if zip FileDocument can be unzipped to new FileDocument, false otherwise.
        Since:
        jcms-5.7.3
        See Also:
        FileDocument.unzipToFileDocuments(java.io.FileFilter, Member)
      • setZipDirectoryAttribute

        public static void setZipDirectoryAttribute​(javax.servlet.http.HttpServletRequest request,
                                                    java.lang.String filename,
                                                    java.io.File tmpDir)
        Store temporary unzip directory of the specified filename in the the request attribute.
        Parameters:
        request - current HttpServletRequest
        filename - the original zip filename for which the unzip directory was created
        tmpDir - the unzip directory
      • getZipDirectoryAttribute

        public static java.io.File getZipDirectoryAttribute​(javax.servlet.http.HttpServletRequest request,
                                                            java.lang.String filename)
        Retrieve the temporarty unzip directory of the specified filename
        Parameters:
        request - current HttpServletRequest
        filename - the zip filename for which we want to retrieve the temporarty zip directory
        Returns:
        the unzip directory
      • removeZipDirectoryAttribute

        public static void removeZipDirectoryAttribute​(javax.servlet.http.HttpServletRequest request,
                                                       java.lang.String filename)
        Remove the temporarty unzip directory of the specified filename from the request attibutes.
        Parameters:
        request - current HttpServletRequest
        filename - the zip filename for which we want to retrieve the temporarty zip directory
      • isUnzippingInProgress

        public static boolean isUnzippingInProgress​(javax.servlet.http.HttpServletRequest request)
        Checks if an unzipping is already being performed.

        Used by the UnzipRightPolicyFilter to prevent unzipping of zip inside zip

        Parameters:
        request - current HttpServletRequest
        Returns:
        true if an unzipping is already being performed, false otherwise
      • setUnzippingState

        public static void setUnzippingState​(javax.servlet.http.HttpServletRequest request)
        Set a request attribute indicating that an unzipping operation is in progress.
        Parameters:
        request - current HttpServletRequest
      • clearUnzippingState

        public static void clearUnzippingState​(javax.servlet.http.HttpServletRequest request)
        Clear the request attribute indicating that an unzipping operation is in progress.
        Parameters:
        request - current HttpServletRequest