|
SAP NetWeaver 7.30 (SP02) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sapportals.portal.prt.util.StringUtils
public class StringUtils
StringUtils is a collection of String utilities in the web environment. Many of the methods of this class serve to get correct and cross-site scripting safe encoding for usage in HTML mark-up, JavaScript String, and URLs. Here are the different context cases: CASE1 (Output BETWEEN tags) <head> <title>[CASE1]</title> </head> <table> <tr> <td>Username</td> <td>[CASE1]</td> </tr> </table> CASE2 (Output INSIDE tags, but output is not a URL) <form name="CASE2"> <input type="text" name="user" value="[CASE2]"> <input type="text" name="user" value='[CASE2]'> </form> <a name="[CASE2]">Click here</a> CASE3 (Output is a URL) <a href="CASE3" style="[CASE3]"><img src="[CASE3]" lowsrc="[CASE3]"></a> CASE4 (Output inside a SCRIPT context, but output is not a string declaration) <script> var a = [CASE4]; [CASE4]; </script> CASE5 (Output is a string declaration in a script) <script> var a = '[CASE5]'; alert("[CASE5]"); </script>
| Field Summary | |
|---|---|
protected static StringBufferPool |
BUFFER_POOL_URLS
|
protected static int |
URL_SIZE
|
| Constructor Summary | |
|---|---|
StringUtils()
|
|
| Method Summary | |
|---|---|
static String |
escapeScriptEndTag(String pStr)
Prepare a string to be used for a javascript string definition with particular care about script tag. |
static String |
escapeToAttributeValue(String input)
Encode a string for output as an attribute string of a tag, no URLs! |
static String |
escapeToAttributeValue(String input,
int maxLength)
Encode a string for output as an attribute string of a tag, no URLs! |
static String |
escapeToHTML(String input)
Encode a string for output between tags (CASE1) |
static String |
escapeToHTML(String input,
int maxLength)
Encode a string for output between tags (CASE1) |
static String |
escapeToJS(String input)
Encode a string inside a JS string declaration (CASE5) |
static String |
escapeToJS(String input,
int maxLength)
Encode a string inside a JS string declaration (CASE5) |
static String |
escapeToURL(String input)
Encode a string that represents a URL (CASE3) Note that this function will call 'disableScriptSignatures'. |
static String |
escapeToURL(String input,
int maxLength)
Encode a string that represents a URL (CASE3) Note that this function will call 'disableScriptSignatures'. |
static boolean |
isEmpty(String str)
|
static String[] |
tokenize(String szInput,
char delimiter)
Take the given string and chop it up into a series of strings. |
static String[] |
tokenize(String szInput,
String szDelim)
Take the given string and chop it up into a series of strings. |
static List |
tokenizeInList(String szInput,
char delimiter)
Take the given string and chop it up into a List. |
static List |
tokenizeInList(String szInput,
String szDelim)
Take the given string and chop it up into a List |
static String |
urlEncode(String s)
A trivial replacement of URLEncoder.encode |
static String |
urlEncode(String s,
char[] forceEncode)
This is an extended version of the URLEncoder.encode method. |
static SharedString |
urlEncodeShared(String s,
char[] forceEncode)
This is an extended version of the URLEncoder.encode method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static StringBufferPool BUFFER_POOL_URLS
protected static int URL_SIZE
| Constructor Detail |
|---|
public StringUtils()
| Method Detail |
|---|
public static String escapeToJS(String input)
input - The string to parse.
public static String escapeToJS(String input,
int maxLength)
input - The string to parse.maxLength - The maximum length the String input SHOULD havepublic static String escapeToHTML(String input)
input - The string to parse.
public static String escapeToHTML(String input,
int maxLength)
input - The string to parse.maxLength - The maximum length the String input SHOULD havepublic static String escapeToAttributeValue(String input)
input - The string to parse.
public static String escapeToAttributeValue(String input,
int maxLength)
input - The string to parse.maxLength - The maximum length the String input SHOULD havepublic static String escapeToURL(String input)
input - The string to parse.
public static String escapeToURL(String input,
int maxLength)
input - The string to parse.maxLength - The maximum length the String input SHOULD havepublic static String escapeScriptEndTag(String pStr)
pStr - input The string to parse.
public static String urlEncode(String s,
char[] forceEncode)
s - The String to be encodedforceEncode - An array of chars that are to be encoded
explicitely. Note: forceEncode should NOT contain digits nor
the percent sign!!
public static SharedString urlEncodeShared(String s,
char[] forceEncode)
s - The Shared String to be encoded.
forceEncode - An array of chars that are to be encoded
explicitely. Note: forceEncode should NOT contain digits nor
the percent sign!!public static String urlEncode(String s)
s - The String to be encoded
public static String[] tokenize(String szInput,
String szDelim)
szInput - the input StringszDelim - the delimiter string
public static List tokenizeInList(String szInput,
String szDelim)
szInput - the input StringszDelim - the delimiter string
public static String[] tokenize(String szInput,
char delimiter)
szInput - the input StringszDelim - the delimiter character
public static List tokenizeInList(String szInput,
char delimiter)
szInput - the input StringszDelim - the delimiter character
public static boolean isEmpty(String str)
| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] EP-BASIS-API
|
[sap.com] tc/epbc/prt/api
|
api
|
EP-PIN
|
[sap.com] EP-BASIS-API
|
[sap.com]
|
default
|
EP-PIN-PRT
|
[sap.com] EP-BASIS-API
|
[sap.com] tc/epbc/prt/lib/api
|
api
|
EP-PIN
|
|
SAP NetWeaver 7.30 (SP02) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||