|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.bamboo.util.BambooStringUtils
public class BambooStringUtils
Field Summary | |
---|---|
static char |
CHAR_APOSTROPHE
|
static char |
CHAR_BACKSLASH
|
static char |
CHAR_DOUBLE_QUOTE
|
static char |
CHAR_ELLIPSIS
|
static char |
CHAR_NONE
|
static char[] |
XSS_RELATED_CHARACTERS
|
static String |
XSS_RELATED_CHARACTERS_FIND_STR
|
Method Summary | |
---|---|
static boolean |
containsDefinedXssRelatedCharacters(String string,
char[] characters)
Deprecated. since 5.0 please use containsRelatedCharacters |
static boolean |
containsRelatedCharacters(String string,
char[] characters)
|
static boolean |
containsRelaxedXssRelatedCharacters(String string)
|
static boolean |
containsShellInjectionRelatedCharacters(String string)
|
static com.google.common.base.Predicate<String> |
containsString(String string)
|
static boolean |
containsXssRelatedCharacters(String string)
Returns true if the supplied string contains characters that could be used to deface a page or trigger an XSS exploit (characters: "&'<>\). |
static String |
dos2unix(String s)
Changes Dos-style line endings to Unix style line endings |
static String |
encodeHtmlWithTagWhiteList(String string)
Escapes string but preserves few defined tags. |
static com.google.common.base.Function<String,String> |
encodeHtmlWithTagWhiteListFunction()
|
static String |
forceAlphaNumeric(String str)
|
static String |
forceValidHtmlId(String id)
According to the HTML standard, ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). |
static String |
formatTemplate(String urlTemplate,
Map<String,String> variableValues)
Expands variable references in urlTemplate with variableValues . |
static String |
getFirstDefinedXssRelatedCharacter(String string,
char[] characters)
Deprecated. since 5.0 please use containsRelatedCharacters |
static String |
getFirstRelatedCharacter(String string,
char[] characters)
|
static String |
getFirstRelaxedXssRelatedCharacter(String string)
|
static String |
getFirstShellInjectionRelatedCharacters(String string)
|
static String |
getFirstXssRelatedCharacter(String string)
Retrieves first unsafe character from supplied string |
static boolean |
in(String needle,
String... haystacks)
|
static int |
indexOf(String haystack,
String needle,
int n)
Returns n-th occurence of string (index is 0-based) |
static int |
indexOfRegex(String haystack,
String needle,
int occurence)
Returns n-th occurence of regex (index is 0-based) |
static Iterable<String> |
lineIterator(String string)
|
static String |
nullIfBlank(String string)
|
static String |
preventInlining(String constant)
This is to prevent inlining. |
static String |
remove(String quotedVarValue,
int index)
Removes a character at specified index from string |
static com.google.common.base.Function<String,String> |
replaceAll(Pattern pattern,
String replacement)
|
static com.google.common.base.Function<String,String> |
replaceAll(String regex,
String replacement)
|
static boolean |
startsWithAny(String string,
Collection<String> searchStrings)
|
static com.google.common.base.Function<String,String> |
stripFullyEnclosingQuotes()
|
static String |
toCamelCase(String string,
char separator)
Returns the string in camel case. |
static String |
toCommandLineString(Iterable<String> commandArgs)
Joins supplied argument into a valid command line, wrapping arguments in single quotes if needed. |
static com.google.common.base.Function<String,String> |
toUpperCase()
|
static String |
truncateAndAddEllipsis(String string,
int maxLength)
Truncates a string to specified length. |
static String |
unquote(String quotedVarValue,
boolean processBackslashes)
Removes quotes from variable using shell rules. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char CHAR_NONE
public static final char CHAR_APOSTROPHE
public static final char CHAR_BACKSLASH
public static final char CHAR_DOUBLE_QUOTE
public static final char CHAR_ELLIPSIS
public static final char[] XSS_RELATED_CHARACTERS
public static final String XSS_RELATED_CHARACTERS_FIND_STR
Method Detail |
---|
@NotNull public static String forceAlphaNumeric(@Nullable String str)
public static boolean containsXssRelatedCharacters(@Nullable String string)
string
- string to check
@NotNull public static String getFirstXssRelatedCharacter(@Nullable String string)
string
- the string to check
public static boolean containsRelaxedXssRelatedCharacters(@Nullable String string)
@NotNull public static String getFirstRelaxedXssRelatedCharacter(@Nullable String string)
public static boolean containsShellInjectionRelatedCharacters(@Nullable String string)
public static String getFirstShellInjectionRelatedCharacters(@Nullable String string)
@Deprecated public static boolean containsDefinedXssRelatedCharacters(@Nullable String string, @NotNull char[] characters)
public static boolean containsRelatedCharacters(@Nullable String string, @NotNull char[] characters)
@Deprecated public static String getFirstDefinedXssRelatedCharacter(@Nullable String string, @NotNull char[] characters)
@NotNull public static String getFirstRelatedCharacter(@Nullable String string, @NotNull char[] characters)
@NotNull public static String forceValidHtmlId(@NotNull String id)
public static Iterable<String> lineIterator(String string)
public static com.google.common.base.Predicate<String> containsString(@NotNull String string)
public static int indexOf(String haystack, String needle, int n)
haystack
- search hereneedle
- search forn
- n-the cocurence to return
public static int indexOfRegex(String haystack, String needle, int occurence)
haystack
- search hereneedle
- search foroccurence
- n-the occurence to return
public static boolean startsWithAny(String string, Collection<String> searchStrings)
StringUtils.startsWithAny(String, String[])
@Nullable public static String nullIfBlank(@Nullable String string)
public static String encodeHtmlWithTagWhiteList(String string)
string
-
public static com.google.common.base.Function<String,String> encodeHtmlWithTagWhiteListFunction()
@NotNull public static String unquote(@NotNull String quotedVarValue, boolean processBackslashes)
quotedVarValue
- processBackslashes
- whether backslash should be treated as a special character or not
public static boolean in(String needle, String... haystacks)
@NotNull public static String remove(@NotNull String quotedVarValue, int index)
quotedVarValue
- index
-
@Nullable public static String truncateAndAddEllipsis(@Nullable String string, int maxLength)
string
- stringmaxLength
- maximum length of the string
public static com.google.common.base.Function<String,String> stripFullyEnclosingQuotes()
public static com.google.common.base.Function<String,String> toUpperCase()
public static com.google.common.base.Function<String,String> replaceAll(Pattern pattern, String replacement)
public static com.google.common.base.Function<String,String> replaceAll(String regex, String replacement)
@NotNull public static String dos2unix(@NotNull String s)
public static String toCamelCase(@NotNull String string, char separator)
string
- separator
-
public static String toCommandLineString(@NotNull Iterable<String> commandArgs)
public static String formatTemplate(String urlTemplate, Map<String,String> variableValues)
urlTemplate
with variableValues
.
The variable references look like "${foo}" and will be replaced with the value matching the that key from
variableValues
. The names may not contain '}' characters but are otherwise unconstrained. Variables
which do not have associated values in the request are unmodified.
urlTemplate
- the template to expand.variableValues
- the variable values to use when expanding the template
public static String preventInlining(String constant)
constant
- The constant to return.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |