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

Method addChild

java/org/apache/catalina/core/StandardHost.java:661–679  ·  view source on GitHub ↗

{@inheritDoc} The child must be an implementation of Context .

(Container child)

Source from the content-addressed store, hash-verified

659 * The child must be an implementation of <code>Context</code>.
660 */
661 @Override
662 public void addChild(Container child) {
663
664 if (!(child instanceof Context context)) {
665 throw new IllegalArgumentException(sm.getString("standardHost.notContext"));
666 }
667
668 child.addLifecycleListener(new MemoryLeakTrackingListener());
669
670 // Avoid NPE for case where Context is defined in server.xml with only a
671 // docBase
672 if (context.getPath() == null) {
673 ContextName cn = new ContextName(context.getDocBase(), true);
674 context.setPath(cn.getPath());
675 }
676
677 super.addChild(child);
678
679 }
680
681
682 /**

Callers

nothing calls this directly

Calls 7

getPathMethod · 0.95
getStringMethod · 0.65
addLifecycleListenerMethod · 0.65
getPathMethod · 0.65
getDocBaseMethod · 0.65
setPathMethod · 0.65
addChildMethod · 0.65

Tested by

no test coverage detected