MCPcopy Index your code
hub / github.com/apache/tomcat / generateInit

Method generateInit

java/org/apache/jasper/compiler/Generator.java:461–495  ·  view source on GitHub ↗

Generates the _jspInit() method for instantiating the tag handler pools. For tag file, _jspInit has to be invoked manually, and the ServletConfig object explicitly passed. In JSP 2.1, we also instantiate an ExpressionFactory

()

Source from the content-addressed store, hash-verified

459 * In JSP 2.1, we also instantiate an ExpressionFactory
460 */
461 private void generateInit() {
462
463 if (ctxt.isTagFile()) {
464 out.printil("private void _jspInit(jakarta.servlet.ServletConfig config) {");
465 } else {
466 out.printil("public void _jspInit() {");
467 }
468
469 out.pushIndent();
470 if (isPoolingEnabled) {
471 for (String tagHandlerPoolName : tagHandlerPoolNames) {
472 out.printin(tagHandlerPoolName);
473 out.print(" = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(");
474 if (ctxt.isTagFile()) {
475 out.print("config");
476 } else {
477 out.print("getServletConfig()");
478 }
479 out.println(");");
480 }
481 }
482
483 // Tag files can't (easily) use lazy init for these so initialise them
484 // here.
485 if (ctxt.isTagFile()) {
486 out.printin(ctxt.getOptions().getVariableForExpressionFactory());
487 out.println(" = _jspxFactory.getJspApplicationContext(config.getServletContext()).getExpressionFactory();");
488 out.printin(ctxt.getOptions().getVariableForInstanceManager());
489 out.println(" = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(config);");
490 }
491
492 out.popIndent();
493 out.printil("}");
494 out.println();
495 }
496
497 /**
498 * Generates the _jspDestroy() method which is responsible for calling the release() method on every tag handler in

Callers 1

genPreambleMethodsMethod · 0.95

Calls 10

pushIndentMethod · 0.80
printinMethod · 0.80
popIndentMethod · 0.80
isTagFileMethod · 0.65
getOptionsMethod · 0.65
printilMethod · 0.45
printMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected