public class JspUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
JspUtil.ValidAttribute |
Modifier and Type | Field and Description |
---|---|
static int |
CHUNKSIZE |
Constructor and Description |
---|
JspUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
booleanValue(java.lang.String s)
Convert a String value to 'boolean'.
|
static void |
checkAttributes(java.lang.String typeOfTag,
org.apache.jasper.compiler.Node n,
JspUtil.ValidAttribute[] validAttributes,
ErrorDispatcher err)
Checks if all mandatory attributes are present and if all attributes
present have valid names.
|
static void |
checkScope(java.lang.String scope,
org.apache.jasper.compiler.Node n,
ErrorDispatcher err)
Checks to see if the given scope is valid.
|
static java.lang.Object |
coerce(java.lang.Class targetType,
java.lang.String value) |
static java.lang.String |
coerceToBoolean(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToByte(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToChar(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToCharacter(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToDouble(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToEnum(java.lang.String s,
java.lang.String enumClass,
boolean isNamedAttribute) |
static java.lang.String |
coerceToFloat(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToInt(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToInteger(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToLong(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToPrimitiveBoolean(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToPrimitiveByte(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToPrimitiveDouble(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToPrimitiveFloat(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToPrimitiveLong(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToPrimitiveShort(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
coerceToShort(java.lang.String s,
boolean isNamedAttribute) |
static java.lang.String |
escapeQueryString(java.lang.String unescString) |
static char[] |
escapeQuotes(char[] chars) |
static java.lang.String |
escapeXml(java.lang.String s)
Escape the 5 entities defined by XML.
|
static java.util.List<java.lang.String> |
expandClassPath(java.util.List<java.lang.String> files)
Given a list of jar files, their manifest attribute Class-path are
scanned, and jars specified there are added to the list.
|
static java.lang.String |
getCanonicalName(java.lang.Class c)
Compute the canonical name from a Class instance.
|
static java.lang.String |
getExpr(java.lang.String expression,
boolean isXml) |
static java.lang.String |
getExprInXml(java.lang.String expression)
Takes a potential expression and converts it into XML form
|
static java.io.InputStream |
getInputStream(java.lang.String fname,
java.util.jar.JarFile jarFile,
JspCompilationContext ctxt,
ErrorDispatcher err) |
static java.lang.String |
getTagHandlerClassName(java.lang.String path,
ErrorDispatcher err)
Gets the fully-qualified class name of the tag handler corresponding to
the given tag file path.
|
static java.lang.String |
interpreterCall(boolean isTagFile,
java.lang.String expression,
java.lang.Class expectedType,
java.lang.String fnmapvar,
java.lang.String expectedDeferredType,
java.lang.String expectedReturnType,
java.lang.String[] expectedParamTypes)
Produces a String representing a call to the EL interpreter.
|
static boolean |
isExpression(java.lang.String token,
boolean isXml)
Checks if the token is a runtime expression.
|
static boolean |
isJavaKeyword(java.lang.String key)
Test whether the argument is a Java keyword
|
static java.lang.String |
makeJavaIdentifier(java.lang.String identifier)
Converts the given identifier to a legal Java identifier
|
static java.lang.String |
makeJavaPackage(java.lang.String path)
Converts the given path to a Java package or fully-qualified class name
|
static java.lang.String |
makeXmlJavaIdentifier(java.lang.String name)
Converts the given Xml name to a legal Java identifier.
|
static java.lang.String |
mangleChar(char ch)
Mangle the specified character to create a legal Java class name.
|
static java.lang.String |
nextTemporaryVariableName()
Generates a new temporary variable name.
|
static char[] |
removeQuotes(char[] chars) |
static java.lang.String |
replace(java.lang.String name,
char replace,
java.lang.String with)
Replaces any occurrences of the character replace with the
string with.
|
static void |
resetTemporaryVariableName()
Resets the temporary variable name.
|
static java.lang.Class<?> |
toClass(java.lang.String type,
java.lang.ClassLoader loader)
Returns the Class object associated with the class or
interface with the given string name.
|
static java.lang.String |
toJavaSourceType(java.lang.String type)
Class.getName() return arrays in the form "[[[
|
static void |
validateExpressions(org.apache.jasper.compiler.Mark where,
java.lang.String expressions,
FunctionMapper functionMapper,
ErrorDispatcher err)
Validates the syntax of all EL expressions within the given string.
|
public static final int CHUNKSIZE
public static char[] removeQuotes(char[] chars)
public static char[] escapeQuotes(char[] chars)
public static boolean isExpression(java.lang.String token, boolean isXml)
token
- The token to be checked
return whether the token is a runtime expression or not.public static java.lang.String getExpr(java.lang.String expression, boolean isXml)
public static java.lang.String getExprInXml(java.lang.String expression)
public static void checkScope(java.lang.String scope, org.apache.jasper.compiler.Node n, ErrorDispatcher err) throws JasperException
scope
- The scope to be checkedn
- The Node containing the 'scope' attribute whose value is to be
checkederr
- error dispatcherJasperException
- if scope is not null and different from
"page", "request", "session", and
"application"public static void checkAttributes(java.lang.String typeOfTag, org.apache.jasper.compiler.Node n, JspUtil.ValidAttribute[] validAttributes, ErrorDispatcher err) throws JasperException
JasperException
public static java.lang.String escapeQueryString(java.lang.String unescString)
public static java.lang.String escapeXml(java.lang.String s)
public static java.lang.String replace(java.lang.String name, char replace, java.lang.String with)
public static boolean booleanValue(java.lang.String s)
s
- the string to be convertedpublic static java.lang.Class<?> toClass(java.lang.String type, java.lang.ClassLoader loader) throws java.lang.ClassNotFoundException
The Class object is determined by passing the given string name to the Class.forName() method, unless the given string name represents a primitive type, in which case it is converted to a Class object by appending ".class" to it (e.g., "int.class").
java.lang.ClassNotFoundException
public static java.lang.String interpreterCall(boolean isTagFile, java.lang.String expression, java.lang.Class expectedType, java.lang.String fnmapvar, java.lang.String expectedDeferredType, java.lang.String expectedReturnType, java.lang.String[] expectedParamTypes)
expression
- a String containing zero or more "${}" expressionsexpectedType
- the expected type of the interpreted resultfnmapvar
- Variable pointing to a function map.public static void validateExpressions(org.apache.jasper.compiler.Mark where, java.lang.String expressions, FunctionMapper functionMapper, ErrorDispatcher err) throws JasperException
where
- the approximate location of the expressions in the JSP pageexpressions
- a string containing an EL expressionserr
- an error dispatcher to useJasperException
public static java.lang.Object coerce(java.lang.Class targetType, java.lang.String value) throws ELException
ELException
public static void resetTemporaryVariableName()
public static java.lang.String nextTemporaryVariableName()
public static java.lang.String coerceToPrimitiveBoolean(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToBoolean(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToPrimitiveByte(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToByte(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToChar(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToCharacter(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToPrimitiveDouble(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToDouble(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToPrimitiveFloat(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToFloat(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToInt(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToInteger(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToPrimitiveShort(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToShort(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToPrimitiveLong(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToLong(java.lang.String s, boolean isNamedAttribute)
public static java.lang.String coerceToEnum(java.lang.String s, java.lang.String enumClass, boolean isNamedAttribute)
public static java.io.InputStream getInputStream(java.lang.String fname, java.util.jar.JarFile jarFile, JspCompilationContext ctxt, ErrorDispatcher err) throws JasperException, java.io.IOException
JasperException
java.io.IOException
public static java.lang.String getTagHandlerClassName(java.lang.String path, ErrorDispatcher err) throws JasperException
path
- Tag file patherr
- Error dispatcherJasperException
public static final java.lang.String makeJavaPackage(java.lang.String path)
path
- Path to convertpublic static final java.lang.String makeJavaIdentifier(java.lang.String identifier)
identifier
- Identifier to convertpublic static final java.lang.String mangleChar(char ch)
public static boolean isJavaKeyword(java.lang.String key)
public static final java.lang.String makeXmlJavaIdentifier(java.lang.String name)
name
- Identifier to convertpublic static java.lang.String toJavaSourceType(java.lang.String type)
public static java.lang.String getCanonicalName(java.lang.Class c)
c
- A instance of java.lang.Classpublic static java.util.List<java.lang.String> expandClassPath(java.util.List<java.lang.String> files)