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

Method scanJspConfig

java/org/apache/jasper/servlet/TldScanner.java:150–197  ·  view source on GitHub ↗

Scan for TLDs defined in <jsp-config>. @throws IOException Error reading resources @throws SAXException XML parsing error

()

Source from the content-addressed store, hash-verified

148 * @throws SAXException XML parsing error
149 */
150 protected void scanJspConfig() throws IOException, SAXException {
151 JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
152 if (jspConfigDescriptor == null) {
153 return;
154 }
155
156 Collection<TaglibDescriptor> descriptors = jspConfigDescriptor.getTaglibs();
157 for (TaglibDescriptor descriptor : descriptors) {
158 String taglibURI = descriptor.getTaglibURI();
159 String resourcePath = descriptor.getTaglibLocation();
160 // Note: Whilst the Servlet 2.4 DTD implies that the location must
161 // be a context-relative path starting with '/', JSP.7.3.6.1 states
162 // explicitly how paths that do not start with '/' should be
163 // handled.
164 if (!resourcePath.startsWith("/")) {
165 resourcePath = WEB_INF + resourcePath;
166 }
167 if (uriTldResourcePathMap.containsKey(taglibURI)) {
168 log.warn(Localizer.getMessage(MSG + ".webxmlSkip", resourcePath, taglibURI));
169 continue;
170 }
171
172 if (log.isTraceEnabled()) {
173 log.trace(Localizer.getMessage(MSG + ".webxmlAdd", resourcePath, taglibURI));
174 }
175
176 URL url = context.getResource(resourcePath);
177 if (url != null) {
178 TldResourcePath tldResourcePath;
179 if (resourcePath.endsWith(".jar")) {
180 // if the path points to a jar file, the TLD is presumed to be
181 // inside at META-INF/taglib.tld
182 tldResourcePath = new TldResourcePath(url, resourcePath, "META-INF/taglib.tld");
183 } else {
184 tldResourcePath = new TldResourcePath(url, resourcePath);
185 }
186 // parse TLD but store using the URI supplied in the descriptor
187 TaglibXml tld = tldParser.parse(tldResourcePath);
188 uriTldResourcePathMap.put(taglibURI, tldResourcePath);
189 tldResourcePathTaglibXmlMap.put(tldResourcePath, tld);
190 if (tld.getListeners() != null) {
191 listeners.addAll(tld.getListeners());
192 }
193 } else {
194 log.warn(Localizer.getMessage(MSG + ".webxmlFailPathDoesNotExist", resourcePath, taglibURI));
195 }
196 }
197 }
198
199 /**
200 * Scan web application resources for TLDs, recursively.

Callers 1

scanMethod · 0.95

Calls 15

getTaglibsMethod · 0.95
getMessageMethod · 0.95
getListenersMethod · 0.95
endsWithMethod · 0.80
getTaglibURIMethod · 0.65
getTaglibLocationMethod · 0.65
warnMethod · 0.65
isTraceEnabledMethod · 0.65
traceMethod · 0.65
getResourceMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected