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

下面列出了怎么用javax.servlet.jsp.tagext.TagAttributeInfo的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 项目: Tomcat8-Source-Read   文件: TagFileProcessor.java
public TagInfo getTagInfo() throws JasperException {

            if (name == null) {
                // XXX Get it from tag file name
            }

            if (bodycontent == null) {
                bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS;
            }

            String tagClassName = JspUtil.getTagHandlerClassName(
                    path, tagLibInfo.getReliableURN(), err);

            TagVariableInfo[] tagVariableInfos = new TagVariableInfo[variableVector
                    .size()];
            variableVector.copyInto(tagVariableInfos);

            TagAttributeInfo[] tagAttributeInfo = new TagAttributeInfo[attributeVector
                    .size()];
            attributeVector.copyInto(tagAttributeInfo);

            return new JasperTagInfo(name, tagClassName, bodycontent,
                    description, tagLibInfo, null, tagAttributeInfo,
                    displayName, smallIcon, largeIcon, tagVariableInfos,
                    dynamicAttrsMapName);
        }
 
源代码3 项目: Tomcat8-Source-Read   文件: TagFileProcessor.java
private void checkUniqueName(String name, String type, Node n,
        TagAttributeInfo attr) throws JasperException {

    HashMap<String, NameEntry> table = (VAR_NAME_FROM.equals(type)) ? nameFromTable : nameTable;
    NameEntry nameEntry = table.get(name);
    if (nameEntry != null) {
        if (!TAG_DYNAMIC.equals(type) ||
                !TAG_DYNAMIC.equals(nameEntry.getType())) {
            int line = nameEntry.getNode().getStart().getLineNumber();
            err.jspError(n, "jsp.error.tagfile.nameNotUnique", type,
                    nameEntry.getType(), Integer.toString(line));
        }
    } else {
        table.put(name, new NameEntry(type, n, attr));
    }
}
 
源代码4 项目: Tomcat8-Source-Read   文件: TagFileProcessor.java
/**
 * Perform miscellaneous checks after the nodes are visited.
 */
void postCheck() throws JasperException {
    // Check that var.name-from-attributes has valid values.
    for (Entry<String, NameEntry> entry : nameFromTable.entrySet()) {
        String key = entry.getKey();
        NameEntry nameEntry = nameTable.get(key);
        NameEntry nameFromEntry = entry.getValue();
        Node nameFromNode = nameFromEntry.getNode();
        if (nameEntry == null) {
            err.jspError(nameFromNode,
                    "jsp.error.tagfile.nameFrom.noAttribute", key);
        } else {
            Node node = nameEntry.getNode();
            TagAttributeInfo tagAttr = nameEntry.getTagAttributeInfo();
            if (!"java.lang.String".equals(tagAttr.getTypeName())
                    || !tagAttr.isRequired()
                    || tagAttr.canBeRequestTime()) {
                err.jspError(nameFromNode,
                        "jsp.error.tagfile.nameFrom.badAttribute",
                        key, Integer.toString(node.getStart()
                                .getLineNumber()));
            }
        }
    }
}
 
源代码5 项目: netbeans   文件: PageInfo.java
public String tagInfoToString(TagInfo tag, String indent) {
    StringBuilder sb = new StringBuilder();
    if (tag != null) {
        sb.append(indent).append("tag name     : ").append(tag.getTagName()).append('\n');  // NOI18N
        sb.append(indent).append("    class    : ").append(tag.getTagClassName()).append('\n');  // NOI18N
        sb.append(indent).append("    attribs  : [");  // NOI18N
        TagAttributeInfo attrs[] = tag.getAttributes();
        for (int i = 0; i < attrs.length; i++) {
            sb.append(attrs[i].getName());
            if (i < attrs.length - 1) {
                sb.append(", ");  // NOI18N
            }
        }
        sb.append("]\n");  // NOI18N
    }
    else {
        sb.append(indent).append("taginfo is null\n");  // NOI18N
    }
    return sb.toString();
}
 
源代码6 项目: 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;
}
 
源代码7 项目: Tomcat7.0.67   文件: TagFileProcessor.java
public TagInfo getTagInfo() throws JasperException {

            if (name == null) {
                // XXX Get it from tag file name
            }

            if (bodycontent == null) {
                bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS;
            }

            String tagClassName = JspUtil.getTagHandlerClassName(
                    path, tagLibInfo.getReliableURN(), err);

            TagVariableInfo[] tagVariableInfos = new TagVariableInfo[variableVector
                    .size()];
            variableVector.copyInto(tagVariableInfos);

            TagAttributeInfo[] tagAttributeInfo = new TagAttributeInfo[attributeVector
                    .size()];
            attributeVector.copyInto(tagAttributeInfo);

            return new JasperTagInfo(name, tagClassName, bodycontent,
                    description, tagLibInfo, tei, tagAttributeInfo,
                    displayName, smallIcon, largeIcon, tagVariableInfos,
                    dynamicAttrsMapName);
        }
 
源代码8 项目: Tomcat7.0.67   文件: TagFileProcessor.java
private void checkUniqueName(String name, String type, Node n,
        TagAttributeInfo attr) throws JasperException {

    HashMap<String, NameEntry> table = (type == VAR_NAME_FROM) ? nameFromTable : nameTable;
    NameEntry nameEntry = table.get(name);
    if (nameEntry != null) {
        if (!TAG_DYNAMIC.equals(type) ||
                !TAG_DYNAMIC.equals(nameEntry.getType())) {
            int line = nameEntry.getNode().getStart().getLineNumber();
            err.jspError(n, "jsp.error.tagfile.nameNotUnique", type,
                    nameEntry.getType(), Integer.toString(line));
        }
    } else {
        table.put(name, new NameEntry(type, n, attr));
    }
}
 
源代码9 项目: Tomcat7.0.67   文件: TagFileProcessor.java
/**
 * Perform miscellaneous checks after the nodes are visited.
 */
void postCheck() throws JasperException {
    // Check that var.name-from-attributes has valid values.
    for (Entry<String, NameEntry> entry : nameFromTable.entrySet()) {
        String key = entry.getKey();
        NameEntry nameEntry = nameTable.get(key);
        NameEntry nameFromEntry = entry.getValue();
        Node nameFromNode = nameFromEntry.getNode();
        if (nameEntry == null) {
            err.jspError(nameFromNode,
                    "jsp.error.tagfile.nameFrom.noAttribute", key);
        } else {
            Node node = nameEntry.getNode();
            TagAttributeInfo tagAttr = nameEntry.getTagAttributeInfo();
            if (!"java.lang.String".equals(tagAttr.getTypeName())
                    || !tagAttr.isRequired()
                    || tagAttr.canBeRequestTime()) {
                err.jspError(nameFromNode,
                        "jsp.error.tagfile.nameFrom.badAttribute",
                        key, Integer.toString(node.getStart()
                                .getLineNumber()));
            }
        }
    }
}
 
源代码10 项目: 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;
}
 
源代码11 项目: tomcatsrc   文件: TagFileProcessor.java
public TagInfo getTagInfo() throws JasperException {

            if (name == null) {
                // XXX Get it from tag file name
            }

            if (bodycontent == null) {
                bodycontent = TagInfo.BODY_CONTENT_SCRIPTLESS;
            }

            String tagClassName = JspUtil.getTagHandlerClassName(
                    path, tagLibInfo.getReliableURN(), err);

            TagVariableInfo[] tagVariableInfos = new TagVariableInfo[variableVector
                    .size()];
            variableVector.copyInto(tagVariableInfos);

            TagAttributeInfo[] tagAttributeInfo = new TagAttributeInfo[attributeVector
                    .size()];
            attributeVector.copyInto(tagAttributeInfo);

            return new JasperTagInfo(name, tagClassName, bodycontent,
                    description, tagLibInfo, tei, tagAttributeInfo,
                    displayName, smallIcon, largeIcon, tagVariableInfos,
                    dynamicAttrsMapName);
        }
 
源代码12 项目: tomcatsrc   文件: TagFileProcessor.java
private void checkUniqueName(String name, String type, Node n,
        TagAttributeInfo attr) throws JasperException {

    HashMap<String, NameEntry> table = (VAR_NAME_FROM.equals(type)) ? nameFromTable : nameTable;
    NameEntry nameEntry = table.get(name);
    if (nameEntry != null) {
        if (!TAG_DYNAMIC.equals(type) ||
                !TAG_DYNAMIC.equals(nameEntry.getType())) {
            int line = nameEntry.getNode().getStart().getLineNumber();
            err.jspError(n, "jsp.error.tagfile.nameNotUnique", type,
                    nameEntry.getType(), Integer.toString(line));
        }
    } else {
        table.put(name, new NameEntry(type, n, attr));
    }
}
 
源代码13 项目: tomcatsrc   文件: TagFileProcessor.java
/**
 * Perform miscellaneous checks after the nodes are visited.
 */
void postCheck() throws JasperException {
    // Check that var.name-from-attributes has valid values.
    for (Entry<String, NameEntry> entry : nameFromTable.entrySet()) {
        String key = entry.getKey();
        NameEntry nameEntry = nameTable.get(key);
        NameEntry nameFromEntry = entry.getValue();
        Node nameFromNode = nameFromEntry.getNode();
        if (nameEntry == null) {
            err.jspError(nameFromNode,
                    "jsp.error.tagfile.nameFrom.noAttribute", key);
        } else {
            Node node = nameEntry.getNode();
            TagAttributeInfo tagAttr = nameEntry.getTagAttributeInfo();
            if (!"java.lang.String".equals(tagAttr.getTypeName())
                    || !tagAttr.isRequired()
                    || tagAttr.canBeRequestTime()) {
                err.jspError(nameFromNode,
                        "jsp.error.tagfile.nameFrom.badAttribute",
                        key, Integer.toString(node.getStart()
                                .getLineNumber()));
            }
        }
    }
}
 
源代码14 项目: packagedrone   文件: TagFileProcessor.java
private void checkUniqueName(String name, Name type, Node n,
                             TagAttributeInfo attr)
        throws JasperException {

    HashMap<String, NameEntry> table =
        (type == Name.VAR_NAME_FROM)? nameFromTable: nameTable;
    NameEntry nameEntry = table.get(name);
    if (nameEntry != null) {
        if (type != Name.TAG_DYNAMIC
                || nameEntry.getType() != Name.TAG_DYNAMIC) {
            int line = nameEntry.getNode().getStart().getLineNumber();
            err.jspError(n, "jsp.error.tagfile.nameNotUnique",
                type.getAttribute(), type.getDirective(),
                nameEntry.getType().getAttribute(),
                nameEntry.getType().getDirective(),
                Integer.toString(line));
        }
    } else {
        table.put(name, new NameEntry(type, n, attr));
    }
}
 
源代码15 项目: Tomcat8-Source-Read   文件: TldRuleSet.java
public TagAttributeInfo toTagAttributeInfo() {
    if (fragment) {
        // JSP8.5.2: for a fragment type is fixed and rexprvalue is true
        type = "javax.servlet.jsp.tagext.JspFragment";
        requestTime = true;
    } else if (deferredValue) {
        type = "javax.el.ValueExpression";
        if (expectedTypeName == null) {
            expectedTypeName = "java.lang.Object";
        }
    } else if (deferredMethod) {
        type = "javax.el.MethodExpression";
        if (methodSignature == null) {
            methodSignature = "java.lang.Object method()";
        }
    }

    // According to JSP spec, for static values (those determined at
    // translation time) the type is fixed at java.lang.String.
    if (!requestTime && type == null) {
        type = "java.lang.String";
    }

    return new TagAttributeInfo(
            name,
            required,
            type,
            requestTime,
            fragment,
            description,
            deferredValue,
            deferredMethod,
            expectedTypeName,
            methodSignature);
}
 
源代码16 项目: Tomcat8-Source-Read   文件: Node.java
/**
 * Checks to see if the attribute of the given name is of type
 * JspFragment.
 *
 * @param name The attribute to check
 *
 * @return {@code true} if it is a JspFragment
 */
public boolean checkIfAttributeIsJspFragment(String name) {
    boolean result = false;

    TagAttributeInfo[] attributes = tagInfo.getAttributes();
    for (int i = 0; i < attributes.length; i++) {
        if (attributes[i].getName().equals(name)
                && attributes[i].isFragment()) {
            result = true;
            break;
        }
    }

    return result;
}
 
源代码17 项目: Tomcat8-Source-Read   文件: Node.java
JspAttribute(TagAttributeInfo tai, String qName, String uri,
        String localName, String value, boolean expr, ELNode.Nodes el,
        boolean dyn) {
    this.qName = qName;
    this.uri = uri;
    this.localName = localName;
    this.value = value;
    this.namedAttributeNode = null;
    this.expression = expr;
    this.el = el;
    this.dynamic = dyn;
    this.namedAttribute = false;
    this.tai = tai;
}
 
源代码18 项目: Tomcat8-Source-Read   文件: Node.java
/**
 * Use this constructor if the JspAttribute represents a named
 * attribute. In this case, we have to store the nodes of the body of
 * the attribute.
 */
JspAttribute(NamedAttribute na, TagAttributeInfo tai, boolean dyn) {
    this.qName = na.getName();
    this.localName = na.getLocalName();
    this.value = null;
    this.namedAttributeNode = na;
    this.expression = false;
    this.el = null;
    this.dynamic = dyn;
    this.namedAttribute = true;
    this.tai = tai;
    this.uri = null;
}
 
源代码19 项目: netbeans   文件: JspCompletionQuery.java
/** Adds to the list of items <code>compItemList</code> new Attribute items.
 * Only those which are not already in tagDir
 * @param sup the syntax support
 * @param compItemList list to add to
 * @param tagDir tag or directive element
 * @param attributeItems list of strings containing suitable values (String or TagAttributeInfo)
 * @param currentAttr current attribute, may be null
 */
private void addAttributeItems(CompletionResultSet result, int offset, JspSyntaxSupport sup, 
        SyntaxElement.TagDirective tagDir, List attributeItems, String currentAttr) {
    for (int i = 0; i < attributeItems.size(); i++) {
        Object item = attributeItems.get(i);
        String attr;
        if (item instanceof TagAttributeInfo)
            attr = ((TagAttributeInfo)item).getName();
        else
            attr = (String)item;
        boolean isThere = tagDir.getAttributes().keySet().contains(attr);
        if (!isThere || attr.equalsIgnoreCase(currentAttr) ||
                (currentAttr != null && attr.startsWith(currentAttr) && attr.length()>currentAttr.length() && !isThere)) {
            if (item instanceof TagAttributeInfo)
                //XXX This is hack for fixing issue #45302 - CC is to aggressive.
                //The definition of the tag and declaration doesn't allow
                //define something like "prefix [uri | tagdir]". In the future
                //it should be rewritten definition of declaration, which allow
                //to do it.
                if ("taglib".equalsIgnoreCase(tagDir.getName())){ //NOI18N
                    if (attr.equalsIgnoreCase("prefix")  //NOI18N
                            || (attr.equalsIgnoreCase("uri") && !tagDir.getAttributes().keySet().contains("tagdir")) //NOI18N
                            || (attr.equalsIgnoreCase("tagdir") && !tagDir.getAttributes().keySet().contains("uri"))) //NOI18N
                        result.addItem(JspCompletionItem.createAttribute(offset, (TagAttributeInfo)item));
                } else {
                    result.addItem(JspCompletionItem.createAttribute(offset, (TagAttributeInfo)item));
                } else
                    result.addItem(JspCompletionItem.createAttribute((String)item, offset));
        }
    }
}
 
源代码20 项目: netbeans   文件: JspCompletionItem.java
@Override //method called from default action 
public boolean substituteText(JTextComponent c, int len) {
    String suffix = isEmpty ? "/>" : ">"; // NOI18N

    if (hasAttributes) {
        suffix = "";
    }

    if (!getItemText().startsWith("/")) {  // NOI18N
        if (!shift) {
            return super.substituteText(c, len, 0);
        }  // NOI18N

        boolean hasAttrs = true;
        if (tagInfo != null) {
            TagAttributeInfo[] tAttrs = tagInfo.getAttributes();
            hasAttrs = (tAttrs != null) ? (tAttrs.length > 0) : true;
        }
        if (hasAttrs) {
            return substituteText(c,
                    getItemText() + (hasAttributes ? "" : " ") + suffix,
                    len,
                    suffix.length());
        } // NOI18N
        else {
            return substituteText(c, getItemText() + suffix, len, 0);
        }
    } else // closing tag
    {
        return substituteText(c, getItemText().substring(1) + ">", len, 0);
    }  // NOI18N

}
 
源代码21 项目: Tomcat7.0.67   文件: Node.java
/**
 * Checks to see if the attribute of the given name is of type
 * JspFragment.
 */
public boolean checkIfAttributeIsJspFragment(String name) {
    boolean result = false;

    TagAttributeInfo[] attributes = tagInfo.getAttributes();
    for (int i = 0; i < attributes.length; i++) {
        if (attributes[i].getName().equals(name)
                && attributes[i].isFragment()) {
            result = true;
            break;
        }
    }

    return result;
}
 
源代码22 项目: Tomcat7.0.67   文件: Node.java
JspAttribute(TagAttributeInfo tai, String qName, String uri,
        String localName, String value, boolean expr, ELNode.Nodes el,
        boolean dyn) {
    this.qName = qName;
    this.uri = uri;
    this.localName = localName;
    this.value = value;
    this.namedAttributeNode = null;
    this.expression = expr;
    this.el = el;
    this.dynamic = dyn;
    this.namedAttribute = false;
    this.tai = tai;
}
 
源代码23 项目: Tomcat7.0.67   文件: Node.java
/**
 * Use this constructor if the JspAttribute represents a named
 * attribute. In this case, we have to store the nodes of the body of
 * the attribute.
 */
JspAttribute(NamedAttribute na, TagAttributeInfo tai, boolean dyn) {
    this.qName = na.getName();
    this.localName = na.getLocalName();
    this.value = null;
    this.namedAttributeNode = na;
    this.expression = false;
    this.el = null;
    this.dynamic = dyn;
    this.namedAttribute = true;
    this.tai = null;
}
 
源代码24 项目: Tomcat7.0.67   文件: TagFileProcessor.java
public TagFileDirectiveVisitor(Compiler compiler,
        TagLibraryInfo tagLibInfo, String name, String path) {
    err = compiler.getErrorDispatcher();
    this.tagLibInfo = tagLibInfo;
    this.name = name;
    this.path = path;
    attributeVector = new Vector<TagAttributeInfo>();
    variableVector = new Vector<TagVariableInfo>();
}
 
源代码25 项目: tomcatsrc   文件: Node.java
/**
 * Checks to see if the attribute of the given name is of type
 * JspFragment.
 */
public boolean checkIfAttributeIsJspFragment(String name) {
    boolean result = false;

    TagAttributeInfo[] attributes = tagInfo.getAttributes();
    for (int i = 0; i < attributes.length; i++) {
        if (attributes[i].getName().equals(name)
                && attributes[i].isFragment()) {
            result = true;
            break;
        }
    }

    return result;
}
 
源代码26 项目: tomcatsrc   文件: Node.java
JspAttribute(TagAttributeInfo tai, String qName, String uri,
        String localName, String value, boolean expr, ELNode.Nodes el,
        boolean dyn) {
    this.qName = qName;
    this.uri = uri;
    this.localName = localName;
    this.value = value;
    this.namedAttributeNode = null;
    this.expression = expr;
    this.el = el;
    this.dynamic = dyn;
    this.namedAttribute = false;
    this.tai = tai;
}
 
源代码27 项目: tomcatsrc   文件: Node.java
/**
 * Use this constructor if the JspAttribute represents a named
 * attribute. In this case, we have to store the nodes of the body of
 * the attribute.
 */
JspAttribute(NamedAttribute na, TagAttributeInfo tai, boolean dyn) {
    this.qName = na.getName();
    this.localName = na.getLocalName();
    this.value = null;
    this.namedAttributeNode = na;
    this.expression = false;
    this.el = null;
    this.dynamic = dyn;
    this.namedAttribute = true;
    this.tai = null;
}
 
源代码28 项目: tomcatsrc   文件: TagFileProcessor.java
public TagFileDirectiveVisitor(Compiler compiler,
        TagLibraryInfo tagLibInfo, String name, String path) {
    err = compiler.getErrorDispatcher();
    this.tagLibInfo = tagLibInfo;
    this.name = name;
    this.path = path;
    attributeVector = new Vector<TagAttributeInfo>();
    variableVector = new Vector<TagVariableInfo>();
}
 
源代码29 项目: packagedrone   文件: Node.java
/**
       * Checks to see if the attribute of the given name is of type
* JspFragment.
       */
      public boolean checkIfAttributeIsJspFragment( String name ) {
          boolean result = false;

   TagAttributeInfo[] attributes = tagInfo.getAttributes();
   for (int i = 0; i < attributes.length; i++) {
if (attributes[i].getName().equals(name) &&
            attributes[i].isFragment()) {
    result = true;
    break;
}
   }
          
          return result;
      }
 
源代码30 项目: packagedrone   文件: TagFileProcessor.java
public TagFileDirectiveVisitor(Compiler compiler,
                               TagLibraryInfo tagLibInfo,
                               String name,
                               String path) {
    err = compiler.getErrorDispatcher();
    this.tagLibInfo = tagLibInfo;
    this.name = name;
    this.path = path;
    attributeVector = new ArrayList<TagAttributeInfo>();
    variableVector = new ArrayList<TagVariableInfo>();

    jspVersionDouble = Double.valueOf(tagLibInfo.getRequiredVersion());
}
 
 类所在包
 同包方法