Class 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
    • Field Detail

      • GRAAL

        public static final boolean GRAAL
    • Constructor Detail

      • JspRuntimeLibrary

        public JspRuntimeLibrary()
    • Method Detail

      • 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.
        request - The Servlet request
        the throwable in the error attribute if any
      • 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)
      • 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.
        propertyName - The property name
        bean - The bean
        method - The method
        values - Array values
        t - The class
        propertyEditorClass - The editor for the property
        JasperException - An error occurred
      • escapeQueryString

        public static String escapeQueryString​(String unescString)
        Escape special shell characters.
        unescString - The string to shell-escape
        The escaped shell string.
      • capitalize

        public static String capitalize​(String name)
        Reverse of Introspector.decapitalize.
        name - The name
        the capitalized string
      • 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
        an absolute path
      • include

        public static void include​(ServletRequest request,
                                   ServletResponse response,
                                   String relativePath,
                                   JspWriter out,
                                   boolean flush)
                            throws IOException,
        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)
        URL encodes a string, based on the supplied character encoding. This performs the same function as in J2SDK1.4, and should be removed if the only platform supported is 1.4 or higher.
        s - The String to be URL encoded.
        enc - The character encoding
        The URL encoded String
      • releaseTag

        public static void releaseTag​(Tag tag,
                                      InstanceManager instanceManager,
                                      boolean reused)
      • releaseTag

        protected static void releaseTag​(Tag tag,
                                         InstanceManager instanceManager)