类javax.servlet.jsp.tagext.TagExtraInfo源码实例Demo

下面列出了怎么用javax.servlet.jsp.tagext.TagExtraInfo的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Tomcat8-Source-Read   文件: JasperTagInfo.java
public JasperTagInfo(String tagName,
        String tagClassName,
        String bodyContent,
        String infoString,
        TagLibraryInfo taglib,
        TagExtraInfo tagExtraInfo,
        TagAttributeInfo[] attributeInfo,
        String displayName,
        String smallIcon,
        String largeIcon,
        TagVariableInfo[] tvi,
        String mapName) {

    super(tagName, tagClassName, bodyContent, infoString, taglib,
            tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon,
            tvi);

    this.dynamicAttrsMapName = mapName;
}
 
源代码2 项目: Tomcat7.0.67   文件: JasperTagInfo.java
public JasperTagInfo(String tagName,
        String tagClassName,
        String bodyContent,
        String infoString,
        TagLibraryInfo taglib,
        TagExtraInfo tagExtraInfo,
        TagAttributeInfo[] attributeInfo,
        String displayName,
        String smallIcon,
        String largeIcon,
        TagVariableInfo[] tvi,
        String mapName) {

    super(tagName, tagClassName, bodyContent, infoString, taglib,
            tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon,
            tvi);
    
    this.dynamicAttrsMapName = mapName;
}
 
源代码3 项目: tomcatsrc   文件: JasperTagInfo.java
public JasperTagInfo(String tagName,
        String tagClassName,
        String bodyContent,
        String infoString,
        TagLibraryInfo taglib,
        TagExtraInfo tagExtraInfo,
        TagAttributeInfo[] attributeInfo,
        String displayName,
        String smallIcon,
        String largeIcon,
        TagVariableInfo[] tvi,
        String mapName) {

    super(tagName, tagClassName, bodyContent, infoString, taglib,
            tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon,
            tvi);
    
    this.dynamicAttrsMapName = mapName;
}
 
源代码4 项目: Tomcat8-Source-Read   文件: Validator.java
@SuppressWarnings("null") // tagInfo can't be null after initial test
@Override
public void visit(Node.CustomTag n) throws JasperException {

    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    /*
     * The bodycontent of a SimpleTag cannot be JSP.
     */
    if (n.implementsSimpleTag()
            && tagInfo.getBodyContent().equalsIgnoreCase(
                    TagInfo.BODY_CONTENT_JSP)) {
        err.jspError(n, "jsp.error.simpletag.badbodycontent", tagInfo
                .getTagClassName());
    }

    /*
     * If the tag handler declares in the TLD that it supports dynamic
     * attributes, it also must implement the DynamicAttributes
     * interface.
     */
    if (tagInfo.hasDynamicAttributes()
            && !n.implementsDynamicAttributes()) {
        err.jspError(n, "jsp.error.dynamic.attributes.not.implemented",
                n.getQName());
    }

    /*
     * Make sure all required attributes are present, either as
     * attributes or named attributes (<jsp:attribute>). Also make sure
     * that the same attribute is not specified in both attributes or
     * named attributes.
     */
    TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
    String customActionUri = n.getURI();
    Attributes attrs = n.getAttributes();
    int attrsSize = (attrs == null) ? 0 : attrs.getLength();
    for (int i = 0; i < tldAttrs.length; i++) {
        String attr = null;
        if (attrs != null) {
            attr = attrs.getValue(tldAttrs[i].getName());
            if (attr == null) {
                attr = attrs.getValue(customActionUri, tldAttrs[i]
                        .getName());
            }
        }
        Node.NamedAttribute na = n.getNamedAttributeNode(tldAttrs[i]
                .getName());

        if (tldAttrs[i].isRequired() && attr == null && na == null) {
            err.jspError(n, "jsp.error.missing_attribute", tldAttrs[i]
                    .getName(), n.getLocalName());
        }
        if (attr != null && na != null) {
            err.jspError(n, "jsp.error.duplicate.name.jspattribute",
                    tldAttrs[i].getName());
        }
    }

    Node.Nodes naNodes = n.getNamedAttributeNodes();
    int jspAttrsSize = naNodes.size() + attrsSize;
    Node.JspAttribute[] jspAttrs = null;
    if (jspAttrsSize > 0) {
        jspAttrs = new Node.JspAttribute[jspAttrsSize];
    }
    Hashtable<String, Object> tagDataAttrs = new Hashtable<>(attrsSize);

    checkXmlAttributes(n, jspAttrs, tagDataAttrs);
    checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);

    TagData tagData = new TagData(tagDataAttrs);

    // JSP.C1: It is a (translation time) error for an action that
    // has one or more variable subelements to have a TagExtraInfo
    // class that returns a non-null object.
    TagExtraInfo tei = tagInfo.getTagExtraInfo();
    if (tei != null && tei.getVariableInfo(tagData) != null
            && tei.getVariableInfo(tagData).length > 0
            && tagInfo.getTagVariableInfos().length > 0) {
        err.jspError("jsp.error.non_null_tei_and_var_subelems", n
                .getQName());
    }

    n.setTagData(tagData);
    n.setJspAttributes(jspAttrs);

    visitBody(n);
}
 
源代码5 项目: Tomcat7.0.67   文件: Validator.java
@Override
public void visit(Node.CustomTag n) throws JasperException {

    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    /*
     * The bodycontent of a SimpleTag cannot be JSP.
     */
    if (n.implementsSimpleTag()
            && tagInfo.getBodyContent().equalsIgnoreCase(
                    TagInfo.BODY_CONTENT_JSP)) {
        err.jspError(n, "jsp.error.simpletag.badbodycontent", tagInfo
                .getTagClassName());
    }

    /*
     * If the tag handler declares in the TLD that it supports dynamic
     * attributes, it also must implement the DynamicAttributes
     * interface.
     */
    if (tagInfo.hasDynamicAttributes()
            && !n.implementsDynamicAttributes()) {
        err.jspError(n, "jsp.error.dynamic.attributes.not.implemented",
                n.getQName());
    }

    /*
     * Make sure all required attributes are present, either as
     * attributes or named attributes (<jsp:attribute>). Also make sure
     * that the same attribute is not specified in both attributes or
     * named attributes.
     */
    TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
    String customActionUri = n.getURI();
    Attributes attrs = n.getAttributes();
    int attrsSize = (attrs == null) ? 0 : attrs.getLength();
    for (int i = 0; i < tldAttrs.length; i++) {
        String attr = null;
        if (attrs != null) {
            attr = attrs.getValue(tldAttrs[i].getName());
            if (attr == null) {
                attr = attrs.getValue(customActionUri, tldAttrs[i]
                        .getName());
            }
        }
        Node.NamedAttribute na = n.getNamedAttributeNode(tldAttrs[i]
                .getName());

        if (tldAttrs[i].isRequired() && attr == null && na == null) {
            err.jspError(n, "jsp.error.missing_attribute", tldAttrs[i]
                    .getName(), n.getLocalName());
        }
        if (attr != null && na != null) {
            err.jspError(n, "jsp.error.duplicate.name.jspattribute",
                    tldAttrs[i].getName());
        }
    }

    Node.Nodes naNodes = n.getNamedAttributeNodes();
    int jspAttrsSize = naNodes.size() + attrsSize;
    Node.JspAttribute[] jspAttrs = null;
    if (jspAttrsSize > 0) {
        jspAttrs = new Node.JspAttribute[jspAttrsSize];
    }
    Hashtable<String, Object> tagDataAttrs = new Hashtable<String, Object>(attrsSize);

    checkXmlAttributes(n, jspAttrs, tagDataAttrs);
    checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);

    TagData tagData = new TagData(tagDataAttrs);

    // JSP.C1: It is a (translation time) error for an action that
    // has one or more variable subelements to have a TagExtraInfo
    // class that returns a non-null object.
    TagExtraInfo tei = tagInfo.getTagExtraInfo();
    if (tei != null && tei.getVariableInfo(tagData) != null
            && tei.getVariableInfo(tagData).length > 0
            && tagInfo.getTagVariableInfos().length > 0) {
        err.jspError("jsp.error.non_null_tei_and_var_subelems", n
                .getQName());
    }

    n.setTagData(tagData);
    n.setJspAttributes(jspAttrs);

    visitBody(n);
}
 
源代码6 项目: tomcatsrc   文件: Validator.java
@Override
public void visit(Node.CustomTag n) throws JasperException {

    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    /*
     * The bodycontent of a SimpleTag cannot be JSP.
     */
    if (n.implementsSimpleTag()
            && tagInfo.getBodyContent().equalsIgnoreCase(
                    TagInfo.BODY_CONTENT_JSP)) {
        err.jspError(n, "jsp.error.simpletag.badbodycontent", tagInfo
                .getTagClassName());
    }

    /*
     * If the tag handler declares in the TLD that it supports dynamic
     * attributes, it also must implement the DynamicAttributes
     * interface.
     */
    if (tagInfo.hasDynamicAttributes()
            && !n.implementsDynamicAttributes()) {
        err.jspError(n, "jsp.error.dynamic.attributes.not.implemented",
                n.getQName());
    }

    /*
     * Make sure all required attributes are present, either as
     * attributes or named attributes (<jsp:attribute>). Also make sure
     * that the same attribute is not specified in both attributes or
     * named attributes.
     */
    TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
    String customActionUri = n.getURI();
    Attributes attrs = n.getAttributes();
    int attrsSize = (attrs == null) ? 0 : attrs.getLength();
    for (int i = 0; i < tldAttrs.length; i++) {
        String attr = null;
        if (attrs != null) {
            attr = attrs.getValue(tldAttrs[i].getName());
            if (attr == null) {
                attr = attrs.getValue(customActionUri, tldAttrs[i]
                        .getName());
            }
        }
        Node.NamedAttribute na = n.getNamedAttributeNode(tldAttrs[i]
                .getName());

        if (tldAttrs[i].isRequired() && attr == null && na == null) {
            err.jspError(n, "jsp.error.missing_attribute", tldAttrs[i]
                    .getName(), n.getLocalName());
        }
        if (attr != null && na != null) {
            err.jspError(n, "jsp.error.duplicate.name.jspattribute",
                    tldAttrs[i].getName());
        }
    }

    Node.Nodes naNodes = n.getNamedAttributeNodes();
    int jspAttrsSize = naNodes.size() + attrsSize;
    Node.JspAttribute[] jspAttrs = null;
    if (jspAttrsSize > 0) {
        jspAttrs = new Node.JspAttribute[jspAttrsSize];
    }
    Hashtable<String, Object> tagDataAttrs = new Hashtable<String, Object>(attrsSize);

    checkXmlAttributes(n, jspAttrs, tagDataAttrs);
    checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);

    TagData tagData = new TagData(tagDataAttrs);

    // JSP.C1: It is a (translation time) error for an action that
    // has one or more variable subelements to have a TagExtraInfo
    // class that returns a non-null object.
    TagExtraInfo tei = tagInfo.getTagExtraInfo();
    if (tei != null && tei.getVariableInfo(tagData) != null
            && tei.getVariableInfo(tagData).length > 0
            && tagInfo.getTagVariableInfos().length > 0) {
        err.jspError("jsp.error.non_null_tei_and_var_subelems", n
                .getQName());
    }

    n.setTagData(tagData);
    n.setJspAttributes(jspAttrs);

    visitBody(n);
}
 
源代码7 项目: packagedrone   文件: Validator.java
public void visit(Node.CustomTag n) throws JasperException {

	    TagInfo tagInfo = n.getTagInfo();
	    if (tagInfo == null) {
		err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
	    }

	    /*
	     * The bodycontent of a SimpleTag cannot be JSP.
	     */
	    if (n.implementsSimpleTag() &&
                tagInfo.getBodyContent().equals(TagInfo.BODY_CONTENT_JSP)) {
                err.jspError(n, "jsp.error.simpletag.badbodycontent",
                             tagInfo.getTagClassName());
	    }

	    /*
	     * If the tag handler declares in the TLD that it supports dynamic
	     * attributes, it also must implement the DynamicAttributes
	     * interface.
	     */
	    if (tagInfo.hasDynamicAttributes()
		    && !n.implementsDynamicAttributes()) {
		err.jspError(n, "jsp.error.dynamic.attributes.not.implemented",
			     n.getQName());
	    }

	    /*
	     * Make sure all required attributes are present, either as
             * attributes or named attributes (<jsp:attribute>).
 	     * Also make sure that the same attribute is not specified in
	     * both attributes or named attributes.
	     */
	    TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
	    String customActionUri = n.getURI();
	    Attributes attrs = n.getAttributes();
	    int attrsSize = (attrs == null) ? 0 : attrs.getLength();
	    for (int i=0; i<tldAttrs.length; i++) {
		String attr = null;
		if (attrs != null) {
		    attr = attrs.getValue(tldAttrs[i].getName());
		    if (attr == null) {
			attr = attrs.getValue(customActionUri,
					      tldAttrs[i].getName());
		    }
		}
		Node.NamedAttribute na =
			n.getNamedAttributeNode(tldAttrs[i].getName());
		
		if (tldAttrs[i].isRequired() && attr == null && na == null) {
		    err.jspError(n, "jsp.error.missing_attribute",
				 tldAttrs[i].getName(), n.getLocalName());
		}
		if (attr != null && na != null) {
		    err.jspError(n, "jsp.error.duplicate.name.jspattribute",
			tldAttrs[i].getName());
		}
	    }

            Node.Nodes naNodes = n.getNamedAttributeNodes();
	    int jspAttrsSize = naNodes.size() + attrsSize;
	    Node.JspAttribute[] jspAttrs = null;
	    if (jspAttrsSize > 0) {
		jspAttrs = new Node.JspAttribute[jspAttrsSize];
	    }
	    Hashtable<String, Object> tagDataAttrs =
                    new Hashtable<String, Object>(attrsSize);

	    checkXmlAttributes(n, jspAttrs, tagDataAttrs);
            checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);

	    TagData tagData = new TagData(tagDataAttrs);

	    // JSP.C1: It is a (translation time) error for an action that
	    // has one or more variable subelements to have a TagExtraInfo
	    // class that returns a non-null object.
	    TagExtraInfo tei = tagInfo.getTagExtraInfo();
	    if (tei != null
		    && tei.getVariableInfo(tagData) != null
		    && tei.getVariableInfo(tagData).length > 0
		    && tagInfo.getTagVariableInfos().length > 0) {
		err.jspError("jsp.error.non_null_tei_and_var_subelems",
			     n.getQName());
	    }

	    n.setTagData(tagData);
	    n.setJspAttributes(jspAttrs);

	    visitBody(n);
	}
 
 类所在包
 类方法
 同包方法