Class GeneralUtil


  • public final class GeneralUtil
    extends SafeGeneralUtil
    Extension of SafeGeneralUtil that contain methods that are not safe for use in Velocity templates. These methods may mutate their input, application state, or returns an object which can.
    • Field Detail

    • Constructor Detail

      • GeneralUtil

        public GeneralUtil()
    • Method Detail

      • setSystemStartupTime

        public static void setSystemStartupTime​(Long systemStartupTime)
      • createTempDirectoryInConfluenceTemp

        public static File createTempDirectoryInConfluenceTemp​(String prefix)
      • createTempFile

        public static File createTempFile​(String directory)
      • setCookie

        public static javax.servlet.http.Cookie setCookie​(String key,
                                                          String value)
        Sets a cookie. set to use a default cookie age of one year and the context path as the default path
        Parameters:
        key - the key of the cookie
        value - the value of the cookie
        Returns:
        the new Cookie object
      • unzipFile

        public static void unzipFile​(File zipFile,
                                     File dirToExtractTo)
                              throws IOException
        Unzips the zip file to the destination directory
        Parameters:
        zipFile - the zip file to extract
        dirToExtractTo - the directory to extract the zip file to
        Throws:
        IOException - if an IOException occurs
      • unzipUrl

        public static void unzipUrl​(URL zipUrl,
                                    File dirToExtractTo)
                             throws IOException
        Unzips the zip url to the destination directory.
        Parameters:
        zipUrl - the URL of the zip file to extract
        dirToExtractTo - the directory to extract the zip file to
        Throws:
        IOException - if an IOException occurs
      • getUnzipper

        public static Unzipper getUnzipper​(URL zipUrl,
                                           File dirToExtractTo)
      • getUserAccessor

        @Deprecated
        public static UserAccessor getUserAccessor()
        Deprecated.
        since 7.3.0, use component injection
      • newWiredConfluenceActionSupport

        @Deprecated(since="8.0")
        public static ConfluenceActionSupport newWiredConfluenceActionSupport​(@Nullable Space space)
        Deprecated.
        since 8.0 no replacement
        Create a wired ConfluenceActionSupport to be used for rendering a decorator.
        Parameters:
        space - A space to add to the rendering context, if provided.
        Since:
        7.5.0
      • getLocalTempDirectory

        @Deprecated
        public static File getLocalTempDirectory()
        Deprecated.
        since 7.12
        Checks if local temp directory exists before returning the path. Create it if it doesn't already exist.
        Returns:
        path to temp directory inside local home
        Since:
        5.5
      • getSharedTempDirectory

        @Deprecated
        public static File getSharedTempDirectory()
        Deprecated.
        since 7.12
        Checks if shared temp directory exists before returning the path. Create it if it doesn't already exist.
        Returns:
        path to temp directory inside shared home
        Since:
        5.5