org.apache.jasper.runtime
类 JspRuntimeLibrary

java.lang.Object
  继承者 org.apache.jasper.runtime.JspRuntimeLibrary

public class JspRuntimeLibrary
extends Object

Bunch of util methods that are used by code generated for useBean, getProperty and setProperty. The __begin, __end stuff is there so that the JSP engine can actually parse this file and inline them if people don't want runtime dependencies on this class. However, I'm not sure if that works so well right now. It got forgotten at some point. -akv

作者:
Mandar Raje, Shawn Bayern

嵌套类摘要
protected static class JspRuntimeLibrary.PrivilegedIntrospectHelper
           
 
构造方法摘要
JspRuntimeLibrary()
           
 
方法摘要
static
<T> T
coerce(String s, Class<T> target)
           
static boolean coerceToBoolean(String s)
           
static byte coerceToByte(String s)
           
static char coerceToChar(String s)
           
static double coerceToDouble(String s)
           
static float coerceToFloat(String s)
           
static int coerceToInt(String s)
           
static long coerceToLong(String s)
           
static short coerceToShort(String s)
           
static Object convert(String propertyName, String s, Class t, Class propertyEditorClass)
           
static void createTypedArray(String propertyName, Object bean, Method method, String[] values, Class t, Class propertyEditorClass)
          Create a typed array.
static String decode(String encoded)
          Decode an URL formatted string.
static String escapeQueryString(String unescString)
          Escape special shell characters.
static String getContextRelativePath(ServletRequest request, String relativePath)
          Convert a possibly relative resource path into a context-relative resource path that starts with a '/'.
static Method getReadMethod(Class beanClass, String prop)
           
static Throwable getThrowable(ServletRequest request)
          Returns the value of the javax.servlet.error.exception request attribute value, if present, otherwise the value of the javax.servlet.jsp.jspException request attribute value.
static Object getValueFromBeanInfoPropertyEditor(Class attrClass, String attrName, String attrValue, Class propertyEditorClass)
           
static Object getValueFromPropertyEditorManager(Class attrClass, String attrName, String attrValue)
           
static Method getWriteMethod(Class beanClass, String prop)
           
static Object handleGetProperty(Object o, String prop)
           
static void handleSetProperty(Object bean, String prop, boolean value)
           
static void handleSetProperty(Object bean, String prop, byte value)
           
static void handleSetProperty(Object bean, String prop, char value)
           
static void handleSetProperty(Object bean, String prop, double value)
           
static void handleSetProperty(Object bean, String prop, float value)
           
static void handleSetProperty(Object bean, String prop, int value)
           
static void handleSetProperty(Object bean, String prop, long value)
           
static void handleSetProperty(Object bean, String prop, Object value)
           
static void handleSetProperty(Object bean, String prop, short value)
           
static void handleSetPropertyExpression(Object bean, String prop, String expression, PageContext pageContext, ProtectedFunctionMapper functionMapper)
          Use proprietaryEvaluate public static void handleSetPropertyExpression(Object bean, String prop, String expression, PageContext pageContext, VariableResolver variableResolver, FunctionMapper functionMapper ) throws JasperException { try { Method method = getWriteMethod(bean.getClass(), prop); method.invoke(bean, new Object[] { pageContext.getExpressionEvaluator().evaluate( expression, method.getParameterTypes()[0], variableResolver, functionMapper, null ) }); } catch (Exception ex) { throw new JasperException(ex); } }
static void include(ServletRequest request, ServletResponse response, String relativePath, JspWriter out, boolean flush)
          Perform a RequestDispatcher.include() operation, with optional flushing of the response beforehand.
static void introspect(Object bean, ServletRequest request)
           
static void introspecthelper(Object bean, String prop, String value, ServletRequest request, String param, boolean ignoreMethodNF)
           
static String toString(boolean b)
           
static String toString(byte b)
           
static String toString(char c)
           
static String toString(double d)
           
static String toString(float f)
           
static String toString(int i)
           
static String toString(long l)
           
static String toString(Object o)
           
static String toString(short s)
           
static String URLEncode(String s, String enc)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

JspRuntimeLibrary

public JspRuntimeLibrary()
方法详细信息

getThrowable

public static Throwable getThrowable(ServletRequest request)
Returns the value of the javax.servlet.error.exception request attribute value, if present, otherwise the value of the javax.servlet.jsp.jspException request attribute value. This method is called at the beginning of the generated servlet code for a JSP error page, when the "exception" implicit scripting language variable is initialized.


coerceToBoolean

public static boolean coerceToBoolean(String s)

coerceToByte

public static byte coerceToByte(String s)

coerceToChar

public static char coerceToChar(String s)

coerceToDouble

public static double coerceToDouble(String s)

coerceToFloat

public static float coerceToFloat(String s)

coerceToInt

public static int coerceToInt(String s)

coerceToShort

public static short coerceToShort(String s)

coerceToLong

public static long coerceToLong(String s)

coerce

public static <T> T coerce(String s,
                           Class<T> target)

convert

public static Object convert(String propertyName,
                             String s,
                             Class t,
                             Class propertyEditorClass)
                      throws JasperException
抛出:
JasperException

introspect

public static void introspect(Object bean,
                              ServletRequest request)
                       throws JasperException
抛出:
JasperException

introspecthelper

public static void introspecthelper(Object bean,
                                    String prop,
                                    String value,
                                    ServletRequest request,
                                    String param,
                                    boolean ignoreMethodNF)
                             throws JasperException
抛出:
JasperException

toString

public static String toString(Object o)

toString

public static String toString(byte b)

toString

public static String toString(boolean b)

toString

public static String toString(short s)

toString

public static String toString(int i)

toString

public static String toString(float f)

toString

public static String toString(long l)

toString

public static String toString(double d)

toString

public static String toString(char c)

createTypedArray

public static void createTypedArray(String propertyName,
                                    Object bean,
                                    Method method,
                                    String[] values,
                                    Class t,
                                    Class propertyEditorClass)
                             throws JasperException
Create a typed array. This is a special case where params are passed through the request and the property is indexed.

抛出:
JasperException

escapeQueryString

public static String escapeQueryString(String unescString)
Escape special shell characters.

参数:
unescString - The string to shell-escape
返回:
The escaped shell string.

decode

public static String decode(String encoded)
Decode an URL formatted string.

参数:
encoded - The string to decode.
返回:
The decoded string.

handleGetProperty

public static Object handleGetProperty(Object o,
                                       String prop)
                                throws JasperException
抛出:
JasperException

handleSetPropertyExpression

public static void handleSetPropertyExpression(Object bean,
                                               String prop,
                                               String expression,
                                               PageContext pageContext,
                                               ProtectedFunctionMapper functionMapper)
                                        throws JasperException
Use proprietaryEvaluate public static void handleSetPropertyExpression(Object bean, String prop, String expression, PageContext pageContext, VariableResolver variableResolver, FunctionMapper functionMapper ) throws JasperException { try { Method method = getWriteMethod(bean.getClass(), prop); method.invoke(bean, new Object[] { pageContext.getExpressionEvaluator().evaluate( expression, method.getParameterTypes()[0], variableResolver, functionMapper, null ) }); } catch (Exception ex) { throw new JasperException(ex); } }

抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     Object value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     int value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     short value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     long value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     double value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     float value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     char value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     byte value)
                              throws JasperException
抛出:
JasperException

handleSetProperty

public static void handleSetProperty(Object bean,
                                     String prop,
                                     boolean value)
                              throws JasperException
抛出:
JasperException

getWriteMethod

public static Method getWriteMethod(Class beanClass,
                                    String prop)
                             throws JasperException
抛出:
JasperException

getReadMethod

public static Method getReadMethod(Class beanClass,
                                   String prop)
                            throws JasperException
抛出:
JasperException

getValueFromBeanInfoPropertyEditor

public static Object getValueFromBeanInfoPropertyEditor(Class attrClass,
                                                        String attrName,
                                                        String attrValue,
                                                        Class propertyEditorClass)
                                                 throws JasperException
抛出:
JasperException

getValueFromPropertyEditorManager

public static Object getValueFromPropertyEditorManager(Class attrClass,
                                                       String attrName,
                                                       String attrValue)
                                                throws JasperException
抛出:
JasperException

getContextRelativePath

public static String getContextRelativePath(ServletRequest request,
                                            String relativePath)
Convert a possibly relative resource path into a context-relative resource path that starts with a '/'.

参数:
request - The servlet request we are processing
relativePath - The possibly relative resource path

include

public static void include(ServletRequest request,
                           ServletResponse response,
                           String relativePath,
                           JspWriter out,
                           boolean flush)
                    throws IOException,
                           ServletException
Perform a RequestDispatcher.include() operation, with optional flushing of the response beforehand.

参数:
request - The servlet request we are processing
response - The servlet response we are processing
relativePath - The relative path of the resource to be included
out - The Writer to whom we are currently writing
flush - Should we flush before the include is processed?
抛出:
IOException - if thrown by the included servlet
ServletException - if thrown by the included servlet

URLEncode

public static String URLEncode(String s,
                               String enc)


Copyright © 2013. All Rights Reserved.