bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Generator.java
private void genPreambleStaticInitializers() throws JasperException {
        out.printil("private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();");
        out.println();

        // Static data for getDependants()
        out.printil("private static java.util.List<String> _jspx_dependants;");
        out.println();
        List<String> dependants = pageInfo.getDependants();
        Iterator<String> iter = dependants.iterator();
        if (!dependants.isEmpty()) {
            out.printil("static {");
            out.pushIndent();
            out.printin("_jspx_dependants = new java.util.ArrayList<String>(");
            out.print("" + dependants.size());
            out.println(");");
            while (iter.hasNext()) {
                out.printin("_jspx_dependants.add(\"");
                out.print(iter.next());
                out.println("\");");
            }
            out.popIndent();
            out.printil("}");
            out.println();
        }

        // Codes to support genStringAsByteArray option
        // Generate a static variable for the initial response encoding
        if (genBytes) {
            // first get the respons encoding
            String contentType = pageInfo.getContentType();
            String encoding = "ISO-8859-1";
            int i = contentType.indexOf("charset=");
            if (i > 0)
                encoding = contentType.substring(i+8);

            // Make sure the encoding is supported
            // Assume that this can be determined at compile time
            try {
                "testing".getBytes(encoding);
                out.printin("private static final String _jspx_encoding = ");
                out.print(quote(encoding));
                out.println(";");
                out.printil("private boolean _jspx_gen_bytes = true;");
                out.printil("private boolean _jspx_encoding_tested;");
            } catch (java.io.UnsupportedEncodingException ex) {
                genBytes = false;
            }
        }
    }
private void genPreambleStaticInitializers() throws JasperException {
        out.printil("private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();");
        out.println();

        // Static data for getDependants()
        out.printil("private static java.util.List<String> _jspx_dependants;");
        out.println();
        List<String> dependants = pageInfo.getDependants();
        Iterator<String> iter = dependants.iterator();
        if (!dependants.isEmpty()) {
            out.printil("static {");
            out.pushIndent();
            out.printin("_jspx_dependants = new java.util.ArrayList<String>(");
            out.print("" + dependants.size());
            out.println(");");
            while (iter.hasNext()) {
                out.printin("_jspx_dependants.add(\"");
                out.print(iter.next());
                out.println("\");");
            }
            out.popIndent();
            out.printil("}");
            out.println();
        }

        // Codes to support genStringAsByteArray option
        // Generate a static variable for the initial response encoding
        if (genBytes) {
            // first get the respons encoding
            String contentType = pageInfo.getContentType();
            String encoding = "ISO-8859-1";
            int i = contentType.indexOf("charset=");
            if (i > 0)
                encoding = contentType.substring(i+8);

            // Make sure the encoding is supported
            // Assume that this can be determined at compile time
            try {
                "testing".getBytes(encoding);
                out.printin("private static final String _jspx_encoding = ");
                out.print(quote(encoding));
                out.println(";");
                out.printil("private boolean _jspx_gen_bytes = true;");
                out.printil("private boolean _jspx_encoding_tested;");
            } catch (java.io.UnsupportedEncodingException ex) {
                genBytes = false;
            }
        }
    }
private void genPreambleStaticInitializers ( ) throws JasperException { out . printil ( "private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();" ) ; out . println ( ) ; // Static data for getDependants() out . printil ( "private static java.util.List<String> _jspx_dependants;" ) ; out . println ( ) ; List < String > dependants = pageInfo . getDependants ( ) ; Iterator < String > iter = dependants . iterator ( ) ; if ( ! dependants . isEmpty ( ) ) { out . printil ( "static {" ) ; out . pushIndent ( ) ; out . printin ( "_jspx_dependants = new java.util.ArrayList<String>(" ) ; out . print ( "" + dependants . size ( ) ) ; out . println ( ");" ) ; while ( iter . hasNext ( ) ) { out . printin ( "_jspx_dependants.add(\"" ) ; out . print ( iter . next ( ) ) ; out . println ( "\");" ) ; } out . popIndent ( ) ; out . printil ( "}" ) ; out . println ( ) ; } // Codes to support genStringAsByteArray option // Generate a static variable for the initial response encoding if ( genBytes ) { // first get the respons encoding String contentType = pageInfo . getContentType ( ) ; String encoding = "ISO-8859-1" ; int i = contentType . indexOf ( "charset=" ) ; if ( i > 0 ) encoding = contentType . substring ( i + 8 ) ; // Make sure the encoding is supported // Assume that this can be determined at compile time try { "testing" . getBytes ( encoding ) ; out . printin ( "private static final String _jspx_encoding = " ) ; out . print ( quote ( encoding ) ) ; out . println ( ";" ) ; out . printil ( "private boolean _jspx_gen_bytes = true;" ) ; out . printil ( "private boolean _jspx_encoding_tested;" ) ; } catch ( java . io . UnsupportedEncodingException ex ) { genBytes = false ; } } }
Generation of static initializers in preamble.
For example, dependant list, el function map, prefix map.
(shared by servlet and tag handler preamble generation)
Generation of static initializers in preamble . For example dependant list el function map prefix map . ( shared by servlet and tag handler preamble generation )