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

Method parseTaglibDirective

java/org/apache/jasper/compiler/Parser.java:380–427  ·  view source on GitHub ↗
(Node parent)

Source from the content-addressed store, hash-verified

378 * Parses a taglib directive with the following syntax: Directive ::= ( S Attribute)*
379 */
380 private void parseTaglibDirective(Node parent) throws JasperException {
381
382 Attributes attrs = parseAttributes();
383 String uri = attrs.getValue("uri");
384 String prefix = attrs.getValue("prefix");
385 if (prefix != null) {
386 Mark prevMark = pageInfo.getNonCustomTagPrefix(prefix);
387 if (prevMark != null) {
388 err.jspError(reader.mark(), "jsp.error.prefix.use_before_dcl", prefix, prevMark.getFile(),
389 "" + prevMark.getLineNumber());
390 }
391 if (uri != null) {
392 String uriPrev = pageInfo.getURI(prefix);
393 if (uriPrev != null && !uriPrev.equals(uri)) {
394 err.jspError(reader.mark(), "jsp.error.prefix.refined", prefix, uri, uriPrev);
395 }
396 if (pageInfo.getTaglib(uri) == null) {
397 TagLibraryInfoImpl impl = null;
398 if (ctxt.getOptions().isCaching()) {
399 impl = (TagLibraryInfoImpl) ctxt.getOptions().getCache().get(uri);
400 }
401 if (impl == null) {
402 TldResourcePath tldResourcePath = ctxt.getTldResourcePath(uri);
403 impl = new TagLibraryInfoImpl(ctxt, parserController, pageInfo, prefix, uri, tldResourcePath,
404 err);
405 if (ctxt.getOptions().isCaching()) {
406 ctxt.getOptions().getCache().put(uri, impl);
407 }
408 }
409 pageInfo.addTaglib(uri, impl);
410 }
411 pageInfo.addPrefixMapping(prefix, uri);
412 } else {
413 String tagdir = attrs.getValue("tagdir");
414 if (tagdir != null) {
415 String urnTagdir = URN_JSPTAGDIR + tagdir;
416 if (pageInfo.getTaglib(urnTagdir) == null) {
417 pageInfo.addTaglib(urnTagdir,
418 new ImplicitTagLibraryInfo(ctxt, parserController, pageInfo, prefix, tagdir, err));
419 }
420 pageInfo.addPrefixMapping(prefix, urnTagdir);
421 }
422 }
423 }
424
425 @SuppressWarnings("unused")
426 Node unused = new Node.TaglibDirective(attrs, start, parent);
427 }
428
429 /*
430 * Parses a directive with the following syntax: Directive ::= S? ( 'page' PageDirective | 'include'

Callers 1

parseDirectiveMethod · 0.95

Calls 15

parseAttributesMethod · 0.95
getFileMethod · 0.95
getLineNumberMethod · 0.95
getNonCustomTagPrefixMethod · 0.80
getTaglibMethod · 0.80
addPrefixMappingMethod · 0.80
getValueMethod · 0.65
jspErrorMethod · 0.65
getURIMethod · 0.65
equalsMethod · 0.65
isCachingMethod · 0.65
getOptionsMethod · 0.65

Tested by

no test coverage detected