node.java

来自「精通tomcat书籍原代码,希望大家共同学习」· Java 代码 · 共 2,370 行 · 第 1/5 页

JAVA
2,370
字号
			    Attributes nonTaglibXmlnsAttrs,
			    Attributes taglibAttrs,
			    Mark start, Node parent) {
	    super(qName, PARAMS_ACTION, null, nonTaglibXmlnsAttrs, taglibAttrs,
		  start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}
    }

    /**
     * Represents a fallback action
     */
    public static class FallBackAction extends Node {

	public FallBackAction(Mark start, Node parent) {
	    this(JSP_FALLBACK_ACTION, null, null, start, parent);
	}

	public FallBackAction(String qName,
			      Attributes nonTaglibXmlnsAttrs,
			      Attributes taglibAttrs, Mark start,
			      Node parent) {
	    super(qName, FALLBACK_ACTION, null, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}
    }

    /**
     * Represents an include action
     */
    public static class IncludeAction extends Node {

	private JspAttribute page;

	public IncludeAction(Attributes attrs, Mark start, Node parent) {
	    this(JSP_INCLUDE_ACTION, attrs, null, null, start, parent);
	}

	public IncludeAction(String qName, Attributes attrs,
			     Attributes nonTaglibXmlnsAttrs,
			     Attributes taglibAttrs, Mark start, Node parent) {
	    super(qName, INCLUDE_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setPage(JspAttribute page) {
	    this.page = page;
	}

	public JspAttribute getPage() {
	    return page;
	}
    }

    /**
     * Represents a forward action
     */
    public static class ForwardAction extends Node {

	private JspAttribute page;

	public ForwardAction(Attributes attrs, Mark start, Node parent) {
	    this(JSP_FORWARD_ACTION, attrs, null, null, start, parent);
	}

	public ForwardAction(String qName, Attributes attrs,
			     Attributes nonTaglibXmlnsAttrs,
			     Attributes taglibAttrs, Mark start, Node parent) {
	    super(qName, FORWARD_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setPage(JspAttribute page) {
	    this.page = page;
	}

	public JspAttribute getPage() {
	    return page;
	}
    }

    /**
     * Represents a getProperty action
     */
    public static class GetProperty extends Node {

	public GetProperty(Attributes attrs, Mark start, Node parent) {
	    this(JSP_GET_PROPERTY_ACTION, attrs, null, null, start, parent);
	}

	public GetProperty(String qName, Attributes attrs,
			   Attributes nonTaglibXmlnsAttrs,
			   Attributes taglibAttrs, Mark start, Node parent) {
	    super(qName, GET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start,  parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}
    }

    /**
     * Represents a setProperty action
     */
    public static class SetProperty extends Node {

	private JspAttribute value;

	public SetProperty(Attributes attrs, Mark start, Node parent) {
	    this(JSP_SET_PROPERTY_ACTION, attrs, null, null, start, parent);
	}

	public SetProperty(String qName, Attributes attrs,
			   Attributes nonTaglibXmlnsAttrs,
			   Attributes taglibAttrs, Mark start, Node parent) {
	    super(qName, SET_PROPERTY_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setValue(JspAttribute value) {
	    this.value = value;
	}

	public JspAttribute getValue() {
	    return value;
	}
    }

    /**
     * Represents a useBean action
     */
    public static class UseBean extends Node {

	JspAttribute beanName;

	public UseBean(Attributes attrs, Mark start, Node parent) {
	    this(JSP_USE_BEAN_ACTION, attrs, null, null, start, parent);
	}

	public UseBean(String qName, Attributes attrs,
		       Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
		       Mark start, Node parent) {
	    super(qName, USE_BEAN_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setBeanName(JspAttribute beanName) {
	    this.beanName = beanName;
	}

	public JspAttribute getBeanName() {
	    return beanName;
	}
    }

    /**
     * Represents a plugin action
     */
    public static class PlugIn extends Node {

        private JspAttribute width;
        private JspAttribute height;
        
	public PlugIn(Attributes attrs, Mark start, Node parent) {
	    this(JSP_PLUGIN_ACTION, attrs, null, null, start, parent);
	}

	public PlugIn(String qName, Attributes attrs,
		      Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
		      Mark start, Node parent) {
	    super(qName, PLUGIN_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setHeight(JspAttribute height) {
	    this.height = height;
	}

	public void setWidth(JspAttribute width) {
	    this.width = width;
	}

	public JspAttribute getHeight() {
	    return height;
	}

	public JspAttribute getWidth() {
	    return width;
	}
    }

    /**
     * Represents an uninterpreted tag, from a Jsp document
     */
    public static class UninterpretedTag extends Node {

	private JspAttribute[] jspAttrs;

	public UninterpretedTag(String qName, String localName,
				Attributes attrs,
				Attributes nonTaglibXmlnsAttrs,
				Attributes taglibAttrs,
				Mark start, Node parent) {
	    super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
		  start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setJspAttributes(JspAttribute[] jspAttrs) {
	    this.jspAttrs = jspAttrs;
	}

	public JspAttribute[] getJspAttributes() {
	    return jspAttrs;
	}
    }
    
    /**
     * Represents a <jsp:element>.
     */
    public static class JspElement extends Node {

	private JspAttribute[] jspAttrs;
	private JspAttribute nameAttr;

	public JspElement(Attributes attrs, Mark start, Node parent) {
	    this(JSP_ELEMENT_ACTION, attrs, null, null, start, parent);
	}

	public JspElement(String qName, Attributes attrs,
			  Attributes nonTaglibXmlnsAttrs,
			  Attributes taglibAttrs, Mark start, Node parent) {
	    super(qName, ELEMENT_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}

	public void setJspAttributes(JspAttribute[] jspAttrs) {
	    this.jspAttrs = jspAttrs;
	}

	public JspAttribute[] getJspAttributes() {
	    return jspAttrs;
	}

	/*
	 * Sets the XML-style 'name' attribute
	 */
	public void setNameAttribute(JspAttribute nameAttr) {
	    this.nameAttr = nameAttr;
	}

	/*
	 * Gets the XML-style 'name' attribute
	 */
	public JspAttribute getNameAttribute() {
	    return this.nameAttr;
	}
    }

    /**
     * Represents a <jsp:output>.
     */
    public static class JspOutput extends Node {

	public JspOutput(String qName, Attributes attrs,
			 Attributes nonTaglibXmlnsAttrs,
			 Attributes taglibAttrs,
			 Mark start, Node parent) {
	    super(qName, OUTPUT_ACTION, attrs, nonTaglibXmlnsAttrs,
		  taglibAttrs, start, parent);
	}

	public void accept(Visitor v) throws JasperException {
	    v.visit(this);
	}
    }

    /**
     * Collected information about child elements.  Used by nodes like
     * CustomTag, JspBody, and NamedAttribute.  The information is 
     * set in the Collector.
     */
    public static class ChildInfo {
	private boolean scriptless;	// true if the tag and its body
					// contain no scripting elements.
	private boolean hasUseBean;
	private boolean hasIncludeAction;
	private boolean hasParamAction;
	private boolean hasSetProperty;
	private boolean hasScriptingVars;

	public void setScriptless(boolean s) {
	    scriptless = s;
	}

	public boolean isScriptless() {
	    return scriptless;
	}

	public void setHasUseBean(boolean u) {
	    hasUseBean = u;
	}

	public boolean hasUseBean() {
	    return hasUseBean;
	}

	public void setHasIncludeAction(boolean i) {
	    hasIncludeAction = i;
	}

	public boolean hasIncludeAction() {
	    return hasIncludeAction;
	}

	public void setHasParamAction(boolean i) {
	    hasParamAction = i;
	}

	public boolean hasParamAction() {
	    return hasParamAction;
	}

	public void setHasSetProperty(boolean s) {
	    hasSetProperty = s;
	}

	public boolean hasSetProperty() {
	    return hasSetProperty;
	}
        
	public void setHasScriptingVars(boolean s) {
	    hasScriptingVars = s;
	}

	public boolean hasScriptingVars() {
	    return hasScriptingVars;
	}
    }

    /**
     * Represents a custom tag
     */
    public static class CustomTag extends Node {

	private String uri;
	private String prefix;
	private JspAttribute[] jspAttrs;
	private TagData tagData;
	private String tagHandlerPoolName;
	private TagInfo tagInfo;
	private TagFileInfo tagFileInfo;
	private Class tagHandlerClass;
	private VariableInfo[] varInfos;
	private int customNestingLevel;
        private ChildInfo childInfo;
	private boolean implementsIterationTag;
	private boolean implementsBodyTag;
	private boolean implementsTryCatchFinally;
	private boolean implementsSimpleTag;
	private boolean implementsDynamicAttributes;
	private Vector atBeginScriptingVars;
	private Vector atEndScriptingVars;
	private Vector nestedScriptingVars;
	private Node.CustomTag customTagParent;
	private Integer numCount;
	private boolean useTagPlugin;
	private TagPluginContext tagPluginContext;

	/**
	 * The following two fields are used for holding the Java
	 * scriptlets that the tag plugins may generate.  Meaningful
	 * only if useTagPlugin is true;
	 * Could move them into TagPluginContextImpl, but we'll need
	 * to cast tagPluginContext to TagPluginContextImpl all the time...
	 */
	private Nodes atSTag;
	private Nodes atETag;

	/*
	 * Constructor for custom action implemented by tag handler.
	 */
	public CustomTag(String qName, String prefix, String localName,
			 String uri, Attributes attrs, Mark start, Node parent,
			 TagInfo tagInfo, Class tagHandlerClass) {
	    this(qName, prefix, localName, uri, attrs, null, null, start,
		 parent, tagInfo, tagHandlerClass);
	}

	/*
	 * Constructor for custom action implemented by tag handler.
	 */
	public CustomTag(String qName, String prefix, String localName,
			 String uri, Attributes attrs,
			 Attributes nonTaglibXmlnsAttrs,
			 Attributes taglibAttrs,
			 Mark start, Node parent, TagInfo tagInfo,
			 Class tagHandlerClass) {
	    super(qName, localName, attrs, nonTaglibXmlnsAttrs, taglibAttrs,
		  start, parent);

	    this.uri = uri;
	    this.prefix = prefix;
	    this.tagInfo = tagInfo;
	    this.tagHandlerClass = tagHandlerClass;
	    this.customNestingLevel = makeCustomNestingLevel();
            this.childInfo = new ChildInfo();

	    this.implementsIterationTag = 
		IterationTag.class.isAssignableFrom(tagHandlerClass);
	    this.implementsBodyTag =
		BodyTag.class.isAssignableFrom(tagHandlerClass);
	    this.implementsTryCatchFinally = 
		TryCatchFinally.class.isAssignableFrom(tagHandlerClass);
	    this.implementsSimpleTag = 
		SimpleTag.class.isAssignableFrom(tagHandlerClass);
	    this.implementsDynamicAttributes = 
		DynamicAttributes.class.isAssignableFrom(tagHandlerClass);
	}

	/*
	 * Constructor for custom action implemented by tag file.
	 */
	public CustomTag(String qName, String prefix, String localName,
			 String uri, Attributes attrs, Mark start, Node parent,
			 TagFileInfo tagFileInfo) {
	    this(qName, prefix, localName, uri, attrs, null, null, start,
		 parent, tagFileInfo);
	}

	/*
	 * Constructor for custom action implemented by tag file.
	 */
	public CustomTag(String qName, String prefix, String localName,
			 String uri, Attributes attrs,
			 Attributes nonTaglibXmlnsAttrs,
			 Attributes taglibAttrs,
			 Mark start, Node parent, TagFileInfo tagFileInfo) {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?