public class Util extends Object
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static String |
cleanValue(String value) |
static boolean |
contains(String name,
String list,
String sep) |
static String |
convertToAlphaNumeric(String text)
Removes all non alpha numerical characters from the passed text.
|
static String |
decodeURI(String text,
XWikiContext context)
Decodes a
application/x-www-form-urlencoded string, the reverse of
encodeURI(String, XWikiContext) . |
static String |
encodeURI(String text,
XWikiContext context)
Translates a string into
application/x-www-form-urlencoded format, so that it can be safely used in
URIs, as a parameter value in a query string or as a segment in the URI path. |
static String |
escapeText(String text)
Deprecated.
dedicated to Radeox which is deprecated since a long time
|
static String |
escapeURL(String url)
Deprecated.
dedicated to Radeox which is deprecated since a long time
|
List<String> |
getAllMatches(String content,
String spattern,
int group) |
static javax.servlet.http.Cookie |
getCookie(String cookieName,
javax.servlet.http.HttpServletRequest request) |
static javax.servlet.http.Cookie |
getCookie(String cookieName,
XWikiContext context) |
Document |
getDOMDocument()
API to get a new DOM document
|
Document |
getDOMForString(String str)
API to obtain a DOM document for the specified string
|
static Date |
getFileLastModificationDate(String path) |
static long |
getHash(String uid)
Get a likely unique 64bit hash representing the provided uid string.
|
static String |
getHTMLExceptionMessage(XWikiException xe,
XWikiContext context) |
org.apache.oro.text.regex.Perl5Matcher |
getMatcher() |
static MonitorPlugin |
getMonitorPlugin(XWikiContext context) |
static String |
getName(String name) |
static String |
getName(String name,
XWikiContext context) |
static Map<String,String[]> |
getObject(XWikiRequest request,
String prefix) |
org.apache.oro.text.perl.Perl5Util |
getP5util() |
static org.apache.oro.text.PatternCache |
getPatterns() |
static URL |
getResource(String resource)
Load resources from: 1.
|
static InputStream |
getResourceAsStream(String resource)
Load resources from: 1.
|
static <T> Map<String,T> |
getSubMap(Map<String,T> map,
String prefix) |
List<String> |
getUniqueMatches(String content,
String spattern,
int group) |
static String |
getWeb(String fullname) |
static boolean |
isAlphaNumeric(String text) |
static boolean |
isValidXMLElementName(String elementName)
Validate a XML element name.
|
static Hashtable<String,String> |
keyValueToHashtable(String mapString)
Create a Map from a string holding a space separated list of key=value pairs.
|
boolean |
match(String pattern,
String text) |
boolean |
matched() |
static String |
noaccents(String text) |
static String |
normalizeLanguage(String languageCode)
Normalize the given language code.
|
static String |
restoreValue(String value) |
Vector<String> |
split(String pattern,
String text) |
String |
substitute(String pattern,
String text) |
String |
substitute(String pattern,
String substitution,
String text) |
public boolean matched()
public org.apache.oro.text.regex.Perl5Matcher getMatcher()
public org.apache.oro.text.perl.Perl5Util getP5util()
public List<String> getAllMatches(String content, String spattern, int group) throws org.apache.oro.text.regex.MalformedPatternException
org.apache.oro.text.regex.MalformedPatternException
public List<String> getUniqueMatches(String content, String spattern, int group) throws org.apache.oro.text.regex.MalformedPatternException
org.apache.oro.text.regex.MalformedPatternException
public static Hashtable<String,String> keyValueToHashtable(String mapString) throws IOException
"this key"="a larger value"
. To use a quote as part
of a key/value, use %_Q_%
.mapString
- The string that must be parsed.IOException
public static org.apache.oro.text.PatternCache getPatterns()
public static Map<String,String[]> getObject(XWikiRequest request, String prefix)
public static boolean isAlphaNumeric(String text)
public static String getName(String name, XWikiContext context)
public static javax.servlet.http.Cookie getCookie(String cookieName, XWikiContext context)
public static javax.servlet.http.Cookie getCookie(String cookieName, javax.servlet.http.HttpServletRequest request)
public static String getHTMLExceptionMessage(XWikiException xe, XWikiContext context)
public static MonitorPlugin getMonitorPlugin(XWikiContext context)
public Document getDOMForString(String str)
str
- The parsed textpublic Document getDOMDocument()
@Deprecated public static String escapeText(String text)
text
- @Deprecated public static String escapeURL(String url)
url
- public static String encodeURI(String text, XWikiContext context)
application/x-www-form-urlencoded
format, so that it can be safely used in
URIs, as a parameter value in a query string or as a segment in the URI path. This uses the UTF-8 encoding, the
default encoding for URIs, as stated in RFC 3986.text
- the non encoded textcontext
- the current contextdecodeURI(String, XWikiContext)
public static String decodeURI(String text, XWikiContext context)
application/x-www-form-urlencoded
string, the reverse of
encodeURI(String, XWikiContext)
. This uses the UTF-8 encoding, the default encoding for URIs, as stated
in RFC 3986.text
- the encoded textcontext
- the current contextencodeURI(String, XWikiContext)
public static String convertToAlphaNumeric(String text)
text
- the text to convertpublic static boolean isValidXMLElementName(String elementName)
elementName
- the XML element name to validatepublic static InputStream getResourceAsStream(String resource)
resource
- resource path to loadpublic static URL getResource(String resource)
resource
- resource path to loadpublic static String normalizeLanguage(String languageCode)
Util.normalizeLanguage(null) = null Util.normalizeLanguage("") = "" Util.normalizeLanguage(" ") = "" Util.normalizeLanguage("default") = "default" Util.normalizeLanguage("DeFault") = "default" Util.normalizeLanguage("invalid") = "default" Util.normalizeLanguage("en") = "en" Util.normalizeLanguage("DE_at") = "de_AT"
languageCode
- the language code to normalizepublic static long getHash(String uid)
uid
- an uid string usually provided by
LocalUidStringEntityReferenceSerializer
or
UidStringEntityReferenceSerializer
Copyright © 2004–2022 XWiki. All rights reserved.