java.lang.Object | |
↳ | com.atlassian.confluence.util.GeneralUtil |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Masks an email address by replacing '@' with 'at' and '.' with 'dot'.
| |||||||||||
convenience method to allow us to determine the size of an int array a velocity file
| |||||||||||
A utility method to encode the given url for protocols which the
CompleteURLEncoder supports.
| |||||||||||
Truncate a string after n characters
| |||||||||||
Takes two calendar objects and sets the Date of the second to the Date of the first.
| |||||||||||
Need a special case of generalutils getpageurl that appends ? or ampersand smartly
this is used to prefix url parameters that are appended after this path like:
showcomments=true#addcomment
| |||||||||||
Escape commas on each entry in the given list of strings.
| |||||||||||
Escapes commas and backslashes with leading backslashes.
| |||||||||||
Escapes " and \ with a leading \ so that strings can't break out of double-quoted HTML attributes.
| |||||||||||
Escapes ', " and \ with a leading \.
| |||||||||||
Take a String which may contain or & and return an XML string containing entities
| |||||||||||
Produces an array of XML escaped
String s from a list of Objects. | |||||||||||
Return a List with no null entries
| |||||||||||
This method is deprecated.
since 3.1 unused anywhere in the application.
| |||||||||||
The build number of the currently running Confluence instance.
| |||||||||||
Returns the duration in a compact HH:mm:ss format.
| |||||||||||
Checks if temp directory exists before returning the path.
| |||||||||||
Get page URL that is id based (i.e.
| |||||||||||
converts a fraction into a percentage
| |||||||||||
Returns a randomised subset of the list provided.
| |||||||||||
This method is deprecated.
since 2.7 use
FriendlyDateFormatter
| |||||||||||
if this error message is of the type: "java.io.IOException: Content Length Error"
convert it to something nicer
| |||||||||||
hack to make strings that contain singles compatible with javascript (which also uses single quotes denote strings)
| |||||||||||
Check if the current installation has more active users than is allowed by the license
| |||||||||||
Take a string and escape the quotes in it with \" and HTML escape them afterwards.
| |||||||||||
This method is deprecated.
This method must not be used anymore, it is horribly inefficient. Rather use the ProfilePictureInfo:
since it is never null, you can ask that object is the user has a default profile picture or not
| |||||||||||
This method is deprecated.
Since Confluence 4.0. This was introduced in Confluence 3.0 but is no longer required.
| |||||||||||
Is "title" something we can safely put in a /foo/bar/title URL? Or should we reference this thing by ID
just to be safe?
| |||||||||||
This method is deprecated.
since 3.5 calls to the PermissionManager will ensure super-user checks are performed
| |||||||||||
This method is deprecated.
since 3.0 because it doesn't do anything
| |||||||||||
Get the default domain name.
| |||||||||||
Create a summary of this content fragment given a query
| |||||||||||
Create a summary of this content fragment.
| |||||||||||
Create a proper summary of this content fragment.
| |||||||||||
Create a proper summary of this content fragment given a query
| |||||||||||
If configured, masks an email address to defeat the most simplistic spam bots.
| |||||||||||
Populate the template String supplied using the given values. | |||||||||||
Convert the supplied Map so that all of the keys in the Map are prefixed by the supplied String
followed by a full stop.
| |||||||||||
A fairly evil hack to work around CONF-10364.
| |||||||||||
Take a String which may contain characters outside of the XML character range (http://www.w3.org/TR/REC-xml/#charsets)
and return a String with those characters converted to Unicode "Replacement Character"s (0xFFFD).
| |||||||||||
Sets a cookie.
| |||||||||||
Returns a substring of the specified string if it is longer than max.
| |||||||||||
Takes a collection of Strings and lowercases the entries.
| |||||||||||
the database lower() function in PostgreSQL only works for ASCII strings.
| |||||||||||
Method will turn a String of comma seperated entities into a String Array.
| |||||||||||
This method is deprecated.
since 2.0 use
summarise(String) instead.
| |||||||||||
Takes a Calendar object and returns the very end (last day, hour, minute, second and milisecond) of the month that the Calendar is in.
| |||||||||||
Unzips the zip file to a folder in temp and returns the File pointing to that expanded folder.
| |||||||||||
Unzips the zip url to a folder in temp and returns the File pointing to that expanded folder.
| |||||||||||
A utility method to encode HTTP form parameter/values.
| |||||||||||
For really long strings that have no spaces or line breaks, browsers such as firefox, Netscape, have difficulty
wrapping them inside a table cell, and so these strings end up stretching the cell longer than its suppose to be = ugly
we want to simulate IE's word-wrap/break function here
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Masks an email address by replacing '@' with 'at' and '.' with 'dot'.
emailAddress | an email address to mask, eg dwillis@atlassian.com |
---|
convenience method to allow us to determine the size of an int array a velocity file
A utility method to encode the given url for protocols which the CompleteURLEncoder supports. To only encode HTTP form parameter/values or fragments, use urlEncode() instead.
url | - the entire URL to encode |
---|
Truncate a string after n characters
s | The String to truncate |
---|---|
length | The maximum length allowed. |
bean | a bean to be converted to a Map. |
---|
Takes two calendar objects and sets the Date of the second to the Date of the first. Used to keep dates consistent regardless of timezones.
Need a special case of generalutils getpageurl that appends ? or ampersand smartly this is used to prefix url parameters that are appended after this path like: showcomments=true#addcomment
Escapes commas and backslashes with leading backslashes.
toEscape | string to escape. If null, then null will be returned. |
---|
Escapes " and \ with a leading \ so that strings can't break out of double-quoted HTML attributes.
Take a String which may contain or & and return an XML string containing entities
Produces an array of XML escaped String
s from a list of Objects. valueOf(Object)
is used
to produce String
s from the Object
s
This method is deprecated.
since 3.1 unused anywhere in the application.
TODO: Replace with a NumberFormatter, similar to DateFormatter
The build number of the currently running Confluence instance.
Returns the duration in a compact HH:mm:ss format.
time | duration in milliseconds |
---|
Checks if temp directory exists before returning the path. Create it if it doesn't already exist.
Get page URL that is id based (i.e. in the format /pages/viewpage.action?pageId=<pageId>)
page | the page to generate a url for |
---|
converts a fraction into a percentage
Returns a randomised subset of the list provided. If the size of the subset is larger than the list, the entire list is returned in a random order.
list | - the list to subset |
---|---|
sizeOfSubset | - the size of the subset to return |
random | - the source of randomness |
This method is deprecated.
since 2.7 use FriendlyDateFormatter
if this error message is of the type: "java.io.IOException: Content Length Error" convert it to something nicer
hack to make strings that contain singles compatible with javascript (which also uses single quotes denote strings)
Check if the current installation has more active users than is allowed by the license
Take a string and escape the quotes in it with \" and HTML escape them afterwards.
We need this function to escape strings containing quotes passed into JavaScript functions
null
input will be returned as an empty String.
This method is deprecated.
This method must not be used anymore, it is horribly inefficient. Rather use the ProfilePictureInfo:
since it is never null, you can ask that object is the user has a default profile picture or not
date | the date to check |
---|---|
maxDays | the number of days into the past the date can fall |
This method is deprecated.
Since Confluence 4.0. This was introduced in Confluence 3.0 but is no longer required.
Ensure the title is safe to be written to the file system. See CONF-10741.
Is "title" something we can safely put in a /foo/bar/title URL? Or should we reference this thing by ID just to be safe?
This method is deprecated.
since 3.5 calls to the PermissionManager will ensure super-user checks are performed
user | the user to check for (the null user will always return false |
---|
Get the default domain name.
request | the request |
---|
Create a summary of this content fragment given a query
Create a summary of this content fragment.
Create a proper summary of this content fragment.
Create a proper summary of this content fragment given a query
If configured, masks an email address to defeat the most simplistic spam bots. If Confluence is not configured to mask email addresses, just returns the original address.
Passing in null to this method will just get you null backemailAddress | the email address to mask |
---|
Populate the template String supplied using the given values. The template may contain place holders which are
denoted numerically in the form {n}
where n is an index into the supplied values list.
e.g. "The template called {1} will expects a colour here {0}".
This template will use value 0 and value 1 from the supplied values array. If the referenced value cannot be found then the place holder will simply be removed.
template | the template to be populated |
---|---|
values | the values used to populate the template |
Convert the supplied Map so that all of the keys in the Map are prefixed by the supplied String followed by a full stop. e.g. monkey could become howler.monkey.
If any of the keys in the Map are not Strings then they will be ignored.
prefix | the prefix to be pre-pended to each Map key, if null then the original Map will be returned. |
---|---|
map | the Map to be modified. If null, then an empty Map will be returned. |
A fairly evil hack to work around CONF-10364. It sucks, but is necessary.
s | to encode |
---|
Take a String which may contain characters outside of the XML character range (http://www.w3.org/TR/REC-xml/#charsets)
and return a String with those characters converted to Unicode "Replacement Character"s (0xFFFD).
Note that this method does not "escape" the string (e.g. "&" is not converted to "&").
Similar to checkCharacterData(String)
but converts illegals instead of throwing Exceptions.
Sets a cookie. set to use a default cookie age of one year and the context path as the default path
Returns a substring of the specified string if it is longer than max. This method also appends "..." to the end of the string if it does truncate it.
Takes a collection of Strings and lowercases the entries.
collection | the collection |
---|
lower(page.title) = :pageTitle
(Where :pageTitle is normally .toLowerCase() first before being passed in)
This special lower case function will skip the JAVA .toLowerCase() for postgres whose database lower() is ineffective.
Method will turn a String of comma seperated entities into a String Array. Spaces before or after the comma will be cropped. Backslashes are treated as escaped characters. Eg when "backslash""comma" is encountered, the backslash is discarded and the comma is not treated as a delimiter.
escapedNames | Comma delimited string with original commas and backslashes escaped by backslashes |
---|
Takes a Calendar object and returns the very end (last day, hour, minute, second and milisecond) of the month that the Calendar is in. The original Calendar object is left unaltered.
Unzips the zip file to a folder in temp and returns the File pointing to that expanded folder.
Exception |
---|
Unzips the zip url to a folder in temp and returns the File pointing to that expanded folder.
Exception |
---|
A utility method to encode HTTP form parameter/values. To encode entire URLs, use completeUrlEncode() instead.
url | - part of the url to encode |
---|
For really long strings that have no spaces or line breaks, browsers such as firefox, Netscape, have difficulty wrapping them inside a table cell, and so these strings end up stretching the cell longer than its suppose to be = ugly
we want to simulate IE's word-wrap/break function herestr | the string to wrap |
---|---|
max | max length of string allowed per line |