javax.servlet.jsp.tagext.TagAttributeInfo Java Examples

The following examples show how to use javax.servlet.jsp.tagext.TagAttributeInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TagFileProcessor.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
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);
        }
 
Example #2
Source File: TagFileProcessor.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
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));
    }
}
 
Example #3
Source File: PageInfo.java    From netbeans with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #4
Source File: JasperTagInfo.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
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;
}
 
Example #5
Source File: TagFileProcessor.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
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));
    }
}
 
Example #6
Source File: JasperTagInfo.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #7
Source File: TagFileProcessor.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * 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()));
            }
        }
    }
}
 
Example #8
Source File: TagFileProcessor.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
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));
    }
}
 
Example #9
Source File: TagFileProcessor.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
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);
        }
 
Example #10
Source File: TagFileProcessor.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * 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()));
            }
        }
    }
}
 
Example #11
Source File: TagFileProcessor.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
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));
    }
}
 
Example #12
Source File: TagFileProcessor.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * 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()));
            }
        }
    }
}
 
Example #13
Source File: JasperTagInfo.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #14
Source File: TagFileProcessor.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
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);
        }
 
Example #15
Source File: Node.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #16
Source File: TldRuleSet.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
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);
}
 
Example #17
Source File: Node.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #18
Source File: Node.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #19
Source File: Node.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source File: Node.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #21
Source File: JspCompletionItem.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@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

}
 
Example #22
Source File: TagFileProcessor.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
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>();
}
 
Example #23
Source File: Node.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #24
Source File: Node.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: Node.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #26
Source File: TagFileProcessor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
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>();
}
 
Example #27
Source File: Node.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
/**
       * 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;
      }
 
Example #28
Source File: TagFileProcessor.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
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());
}
 
Example #29
Source File: TagFileProcessor.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
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, err);

            TagVariableInfo[] tagVariableInfos
                = variableVector.toArray(new TagVariableInfo[0]);

            TagAttributeInfo[] tagAttributeInfo
                = attributeVector.toArray(new TagAttributeInfo[0]);

            return new JasperTagInfo(name,
			       tagClassName,
			       bodycontent,
			       description,
			       tagLibInfo,
			       tei,
			       tagAttributeInfo,
			       displayName,
			       smallIcon,
			       largeIcon,
			       tagVariableInfos,
			       dynamicAttrsMapName);
        }
 
Example #30
Source File: TagFileProcessor.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
/**
    * Perform miscelleaneous checks after the nodes are visited.
    */
   void postCheck() throws JasperException {
       // Check that var.name-from-attributes has valid values.
Iterator iter = nameFromTable.keySet().iterator();
       while (iter.hasNext()) {
           String nameFrom = (String) iter.next();
           NameEntry nameEntry = nameTable.get(nameFrom);
           NameEntry nameFromEntry = nameFromTable.get(nameFrom);
           Node nameFromNode = nameFromEntry.getNode();
           if (nameEntry == null) {
               err.jspError(nameFromNode,
                            "jsp.error.tagfile.nameFrom.noAttribute",
                            nameFrom);
           } 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",
                       nameFrom,
                       Integer.toString(node.getStart().getLineNumber()));
                }
           }
       }
   }