Package com.atlassian.confluence.util
Class GeneralUtil
- java.lang.Object
-
- com.atlassian.confluence.util.SafeGeneralUtil
-
- com.atlassian.confluence.util.GeneralUtil
-
public final class GeneralUtil extends SafeGeneralUtil
Extension ofSafeGeneralUtil
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 Summary
Fields Modifier and Type Field Description static GeneralUtil
INSTANCE
-
Fields inherited from class com.atlassian.confluence.util.SafeGeneralUtil
systemStartupTime
-
-
Constructor Summary
Constructors Constructor Description GeneralUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static File
createTempDirectoryInConfluenceTemp(String prefix)
static File
createTempFile(String directory)
static File
getConfluenceTempDirectory()
Deprecated.since 5.5.static File
getLocalTempDirectory()
Deprecated.since 7.12static File
getSharedTempDirectory()
Deprecated.since 7.12static Unzipper
getUnzipper(File zipFile, File dirToExtractTo)
static Unzipper
getUnzipper(URL zipUrl, File dirToExtractTo)
static UserAccessor
getUserAccessor()
Deprecated.since 7.3.0, use component injectionstatic ConfluenceActionSupport
newWiredConfluenceActionSupport()
Deprecated.since 8.0 no replacementstatic ConfluenceActionSupport
newWiredConfluenceActionSupport(@Nullable Space space)
Deprecated.since 8.0 no replacementstatic javax.servlet.http.Cookie
setCookie(String key, String value)
Deprecated.since 8.7 useCookies.setCookie(String, String)
static void
setSystemStartupTime(Long systemStartupTime)
static void
unzipFile(File zipFile, File dirToExtractTo)
Unzips the zip file to the destination directorystatic void
unzipUrl(URL zipUrl, File dirToExtractTo)
Unzips the zip url to the destination directory.-
Methods inherited from class com.atlassian.confluence.util.SafeGeneralUtil
alwaysMaskEmail, appendAmpersandOrQuestionMark, applyIfNonNull, arraySize, base64Decode, base64Encode, cleanQuietly, completeUrlEncode, constrainLength, convertBeanToMap, convertMailFormatDate, convertToBoolean, convertToBoolean, convertToCharacter, convertToInteger, convertToString, copyDate, customGetPageUrl, displayShortUrl, displayShortUrl, doubleUrlEncode, elapse, escapeCDATA, escapeCommas, escapeCommas, escapeForHtmlAttribute, escapeForJavascript, escapeXml, escapeXml, escapeXMLCharacters, filterNulls, findAndMaskEmail, flushResponse, formatLongTime, getAttachmentUrl, getBuildDate, getBuildDateString, getBuildNumber, getCharacterEncoding, getCommentUrl, getCompactDuration, getConfluenceTempDirectoryPath, getCookieValue, getCookieValue, getDefaultCharset, getDefaultResourceBundle, getEditPageUrl, getFormatDateSimple, getGlobalSettings, getI18n, getIdBasedPageUrl, getImageInfo, getNiceDuration, getOriginalUrl, getPageUrl, getPageUrl, getParentComment, getParentPageOrBlog, getPercentage, getPercentage, getRandomSubSet, getRelativeTime, getRequestCorrelationId, getServerRenderTime, getStackTrace, getSystemStartupTime, getVersionNumber, hackSingleQuotes, hasTooManyUsers, highlight, htmlEncode, htmlEncodeAndReplaceSpaces, htmlEscapeQuotes, isAllAscii, isAllLettersOrNumbers, isDateWithin24Hours, isInLastDays, isLicenseExpired, isSafeTitleForFilesystem, isSafeTitleForUrl, isSetupComplete, lookupDomainName, makeFlatSummary, makeFlatSummary, makeSummary, makeSummary, maskEmail, maskEmail, maskEmail, plain2html, populateSimpleMessage, prefixAllMapKeys, profilePop, profilePush, rdfEncode, refineOsDestination, removeEmailsFromString, replaceConfluenceConstants, replaceConfluenceHomeConstant, replaceInvalidXmlCharacters, safeSubList, shortenString, shouldUrlDecode, sortList, specialLowerCaseCollection, specialToLowerCase, splitCommaDelimitedString, stringSet, summarise, toEndOfMonth, trimDownStringToWord, unescapeCDATA, unescapeEntities, urlDecode, urlEncode, urlEncode, wordWrap
-
-
-
-
Field Detail
-
INSTANCE
public static final GeneralUtil INSTANCE
-
-
Method Detail
-
setSystemStartupTime
public static void setSystemStartupTime(Long systemStartupTime)
-
createTempDirectoryInConfluenceTemp
public static File createTempDirectoryInConfluenceTemp(String prefix)
-
setCookie
@Deprecated public static javax.servlet.http.Cookie setCookie(String key, String value)
Deprecated.since 8.7 useCookies.setCookie(String, String)
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 cookievalue
- 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 extractdirToExtractTo
- the directory to extract the zip file to- Throws:
IOException
- if an IOException occurs
-
getUnzipper
public static Unzipper getUnzipper(File zipFile, File dirToExtractTo) throws IOException
- Throws:
IOException
-
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 extractdirToExtractTo
- the directory to extract the zip file to- Throws:
IOException
- if an IOException occurs
-
getUserAccessor
@Deprecated public static UserAccessor getUserAccessor()
Deprecated.since 7.3.0, use component injection
-
newWiredConfluenceActionSupport
@Deprecated(since="8.0") public static ConfluenceActionSupport newWiredConfluenceActionSupport()
Deprecated.since 8.0 no replacement
-
newWiredConfluenceActionSupport
@Deprecated(since="8.0") public static ConfluenceActionSupport newWiredConfluenceActionSupport(@Nullable Space space)
Deprecated.since 8.0 no replacementCreate a wiredConfluenceActionSupport
to be used for rendering a decorator.- Parameters:
space
- A space to add to the rendering context, if provided.- Since:
- 7.5.0
-
getConfluenceTempDirectory
@Deprecated public static File getConfluenceTempDirectory()
Deprecated.since 5.5. UsegetLocalTempDirectory()
instead.
-
getLocalTempDirectory
@Deprecated public static File getLocalTempDirectory()
Deprecated.since 7.12Checks 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.12Checks 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
-
-