use of org.apache.tomcat.util.descriptor.tld.TldResourcePath in project tomcat by apache.
the class Parser method parseTaglibDirective.
/*
* Parses a taglib directive with the following syntax: Directive ::= ( S
* Attribute)*
*/
private void parseTaglibDirective(Node parent) throws JasperException {
Attributes attrs = parseAttributes();
String uri = attrs.getValue("uri");
String prefix = attrs.getValue("prefix");
if (prefix != null) {
Mark prevMark = pageInfo.getNonCustomTagPrefix(prefix);
if (prevMark != null) {
err.jspError(reader.mark(), "jsp.error.prefix.use_before_dcl", prefix, prevMark.getFile(), "" + prevMark.getLineNumber());
}
if (uri != null) {
String uriPrev = pageInfo.getURI(prefix);
if (uriPrev != null && !uriPrev.equals(uri)) {
err.jspError(reader.mark(), "jsp.error.prefix.refined", prefix, uri, uriPrev);
}
if (pageInfo.getTaglib(uri) == null) {
TagLibraryInfoImpl impl = null;
if (ctxt.getOptions().isCaching()) {
impl = (TagLibraryInfoImpl) ctxt.getOptions().getCache().get(uri);
}
if (impl == null) {
TldResourcePath tldResourcePath = ctxt.getTldResourcePath(uri);
impl = new TagLibraryInfoImpl(ctxt, parserController, pageInfo, prefix, uri, tldResourcePath, err);
if (ctxt.getOptions().isCaching()) {
ctxt.getOptions().getCache().put(uri, impl);
}
}
pageInfo.addTaglib(uri, impl);
}
pageInfo.addPrefixMapping(prefix, uri);
} else {
String tagdir = attrs.getValue("tagdir");
if (tagdir != null) {
String urnTagdir = URN_JSPTAGDIR + tagdir;
if (pageInfo.getTaglib(urnTagdir) == null) {
pageInfo.addTaglib(urnTagdir, new ImplicitTagLibraryInfo(ctxt, parserController, pageInfo, prefix, tagdir, err));
}
pageInfo.addPrefixMapping(prefix, urnTagdir);
}
}
}
@SuppressWarnings("unused") Node unused = new Node.TaglibDirective(attrs, start, parent);
}
use of org.apache.tomcat.util.descriptor.tld.TldResourcePath in project tomee by apache.
the class TomEETldScanner method scanPlatform.
@Override
protected void scanPlatform() {
super.scanPlatform();
if (URLClassLoaderFirst.shouldSkipJsf(Thread.currentThread().getContextClassLoader(), "javax.faces.FactoryFinder")) {
uriTldResourcePathMapParent.putAll(URI_TLD_RESOURCE);
tldResourcePathTaglibXmlMapParent.putAll(TLD_RESOURCE_TAG_LIB);
} else {
// exclude myfaces
for (final Map.Entry<String, TldResourcePath> entry : URI_TLD_RESOURCE.entrySet()) {
final TldResourcePath path = entry.getValue();
if (path.getUrl() != MYFACES_URL) {
// ref works
uriTldResourcePathMapParent.put(entry.getKey(), path);
final TaglibXml tl = TLD_RESOURCE_TAG_LIB.get(path);
if (tl != null) {
tldResourcePathTaglibXmlMapParent.put(path, tl);
}
}
}
}
}
Aggregations