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

Method init

java/org/apache/jasper/compiler/TagPluginManager.java:72–123  ·  view source on GitHub ↗
(ErrorDispatcher err)

Source from the content-addressed store, hash-verified

70 }
71
72 private synchronized void init(ErrorDispatcher err) throws JasperException {
73 if (initialized) {
74 return;
75 }
76
77 String blockExternalString = ctxt.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
78 boolean blockExternal;
79 if (blockExternalString == null) {
80 blockExternal = true;
81 } else {
82 blockExternal = Boolean.parseBoolean(blockExternalString);
83 }
84
85 TagPluginParser parser;
86 Thread currentThread = Thread.currentThread();
87 ClassLoader original = currentThread.getContextClassLoader();
88 try {
89 currentThread.setContextClassLoader(TagPluginManager.class.getClassLoader());
90
91 parser = new TagPluginParser(ctxt, blockExternal);
92
93 Enumeration<URL> urls = ctxt.getClassLoader().getResources(META_INF_JASPER_TAG_PLUGINS_XML);
94 while (urls.hasMoreElements()) {
95 URL url = urls.nextElement();
96 parser.parse(url);
97 }
98
99 URL url = ctxt.getResource(TAG_PLUGINS_XML);
100 if (url != null) {
101 parser.parse(url);
102 }
103 } catch (IOException | SAXException e) {
104 throw new JasperException(e);
105 } finally {
106 currentThread.setContextClassLoader(original);
107 }
108
109 Map<String,String> plugins = parser.getPlugins();
110 tagPlugins = new HashMap<>(plugins.size());
111 for (Map.Entry<String,String> entry : plugins.entrySet()) {
112 try {
113 String tagClass = entry.getKey();
114 String pluginName = entry.getValue();
115 Class<?> pluginClass = ctxt.getClassLoader().loadClass(pluginName);
116 TagPlugin plugin = (TagPlugin) pluginClass.getConstructor().newInstance();
117 tagPlugins.put(tagClass, plugin);
118 } catch (Exception e) {
119 err.jspError(e);
120 }
121 }
122 initialized = true;
123 }
124
125 /**
126 * Invoke tag plugin for the given custom tag, if a plugin exists for the custom tag's tag handler.

Callers 1

applyMethod · 0.95

Calls 15

parseMethod · 0.95
getPluginsMethod · 0.95
parseBooleanMethod · 0.80
getInitParameterMethod · 0.65
getClassLoaderMethod · 0.65
getResourcesMethod · 0.65
getResourceMethod · 0.65
getValueMethod · 0.65
newInstanceMethod · 0.65
putMethod · 0.65
jspErrorMethod · 0.65
hasMoreElementsMethod · 0.45

Tested by

no test coverage detected