Search in sources :

Example 6 with TagInfo

use of jakarta.servlet.jsp.tagext.TagInfo in project tomcat by apache.

the class TagLibraryInfoImpl method createTagInfo.

private TagInfo createTagInfo(TagXml tagXml) throws JasperException {
    String teiClassName = tagXml.getTeiClass();
    TagExtraInfo tei = null;
    if (teiClassName != null && !teiClassName.isEmpty()) {
        try {
            Class<?> teiClass = ctxt.getClassLoader().loadClass(teiClassName);
            tei = (TagExtraInfo) teiClass.getConstructor().newInstance();
        } catch (Exception e) {
            err.jspError(e, "jsp.error.teiclass.instantiation", teiClassName);
        }
    }
    List<TagAttributeInfo> attributeInfos = tagXml.getAttributes();
    List<TagVariableInfo> variableInfos = tagXml.getVariables();
    return new TagInfo(tagXml.getName(), tagXml.getTagClass(), tagXml.getBodyContent(), tagXml.getInfo(), this, tei, attributeInfos.toArray(new TagAttributeInfo[0]), tagXml.getDisplayName(), tagXml.getSmallIcon(), tagXml.getLargeIcon(), variableInfos.toArray(new TagVariableInfo[0]), tagXml.hasDynamicAttributes());
}
Also used : TagExtraInfo(jakarta.servlet.jsp.tagext.TagExtraInfo) TagAttributeInfo(jakarta.servlet.jsp.tagext.TagAttributeInfo) TagInfo(jakarta.servlet.jsp.tagext.TagInfo) TagVariableInfo(jakarta.servlet.jsp.tagext.TagVariableInfo) URISyntaxException(java.net.URISyntaxException) JasperException(org.apache.jasper.JasperException) IOException(java.io.IOException)

Example 7 with TagInfo

use of jakarta.servlet.jsp.tagext.TagInfo in project tomcat by apache.

the class TagLibraryInfoImpl method createTagFileInfo.

// Impossible for path to be null at warning
@SuppressWarnings("null")
private TagFileInfo createTagFileInfo(TagFileXml tagFileXml, Jar jar) throws JasperException {
    String name = tagFileXml.getName();
    String path = tagFileXml.getPath();
    if (path == null) {
        // path is required
        err.jspError("jsp.error.tagfile.missingPath");
    } else if (!path.startsWith("/META-INF/tags") && !path.startsWith("/WEB-INF/tags")) {
        err.jspError("jsp.error.tagfile.illegalPath", path);
    }
    if (jar == null && path.startsWith("/META-INF/tags")) {
        // This is a tag file that was packaged in a JAR that has been
        // unpacked into /WEB-INF/classes (probably by an IDE). Adjust the
        // path accordingly.
        path = "/WEB-INF/classes" + path;
    }
    TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives(parserController, name, path, jar, this);
    return new TagFileInfo(name, path, tagInfo);
}
Also used : TagFileInfo(jakarta.servlet.jsp.tagext.TagFileInfo) TagInfo(jakarta.servlet.jsp.tagext.TagInfo)

Aggregations

TagInfo (jakarta.servlet.jsp.tagext.TagInfo)7 TagFileInfo (jakarta.servlet.jsp.tagext.TagFileInfo)5 JasperException (org.apache.jasper.JasperException)4 TagAttributeInfo (jakarta.servlet.jsp.tagext.TagAttributeInfo)2 TagLibraryInfo (jakarta.servlet.jsp.tagext.TagLibraryInfo)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 FunctionInfo (jakarta.servlet.jsp.tagext.FunctionInfo)1 TagExtraInfo (jakarta.servlet.jsp.tagext.TagExtraInfo)1 TagVariableInfo (jakarta.servlet.jsp.tagext.TagVariableInfo)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 URISyntaxException (java.net.URISyntaxException)1 Attributes (org.xml.sax.Attributes)1 SAXException (org.xml.sax.SAXException)1 SAXParseException (org.xml.sax.SAXParseException)1