com.caucho.jsp.java
Class JspNode

java.lang.Object
  extended by com.caucho.jsp.java.JspNode
Direct Known Subclasses:
JspContainerNode, JspDeclaration, JspDirectiveAttribute, JspDirectiveInclude, JspDirectivePage, JspDirectiveTag, JspDirectiveTaglib, JspDirectiveVariable, JspDoBody, JspExpression, JspForward, JspInclude, JspInvoke, JspOutput, JspParam, JspParamNode, JspParams, JspPlugin, JspScriptlet, JspText, JspTextNode, StaticText

public abstract class JspNode
extends java.lang.Object


Field Summary
protected  int _endAttributeLine
           
protected  int _endLine
           
protected  java.lang.String _filename
           
protected  JavaJspGenerator _gen
           
protected  QName _name
           
protected  Namespace _ns
           
protected  JspNode _parent
           
protected  ParseState _parseState
           
protected  Path _sourcePath
           
protected  int _startLine
           
 
Constructor Summary
protected JspNode()
           
 
Method Summary
 void addAttribute(QName name, JspAttribute value)
          Adds a JspAttribute attribute.
 void addAttribute(QName name, java.lang.String value)
          Adds an attribute.
 void addChild(JspNode node)
          Adds a child node.
 void addChildEnd(JspNode node)
          Adds a child node after its completely initialized..
 void addNamespace(java.lang.String prefix, java.lang.String value)
          Adds a namespace, e.g.
 void addNamespaceRec(java.lang.String prefix, java.lang.String value)
          Adds a namespace, e.g.
 JspNode addText(java.lang.String text)
          Adds text.
protected  boolean attributeToBoolean(java.lang.String attr, java.lang.String value)
          Converts the string to a boolean.
protected  java.lang.String classToString(java.lang.Class<?> cl)
           
 void convertParameterValue(JspJavaWriter out, java.lang.String type, java.lang.String value)
           
 void endAttributes()
          Called after all the attributes from the tag.
 void endElement()
          Called when the tag closes.
protected  JspParseException error(java.lang.String msg)
          Creates a parse exception with the proper line information.
protected  JspParseException error(java.lang.String msg, java.lang.Throwable e)
          Creates a parse exception with the proper line information.
protected  JspParseException error(java.lang.Throwable e)
          Creates a parse exception with the proper line information.
static java.lang.String escapeJavaString(java.lang.String s)
          Escapes a java string.
 JspNode findScriptingNode()
          Finds the first scripting node
abstract  void generate(JspJavaWriter out)
          Generates the code for the tag
 void generateChildren(JspJavaWriter out)
          Generates the code for the children.
 void generateChildrenEmpty()
          Generates the code for the children.
 void generateClassEpilogue(JspJavaWriter out)
          Generates the code for the tag
 void generateClassEpilogueChildren(JspJavaWriter out)
          Generates the code for the tag
 void generateDeclaration(JspJavaWriter out)
          generates declaration data.
 void generateDeclarationChildren(JspJavaWriter out)
          generates data for declaration children.
protected  java.lang.String generateELValue(java.lang.Class<?> type, java.lang.String value)
           
 void generateEmpty()
          Generates the code for the tag
 void generateEndLocation(JspJavaWriter out)
          Generates the start location.
protected  java.lang.String generateFragment(JspFragmentNode frag, java.lang.String contextVar)
          Generates the code for a fragment.
protected  void generateIncludeUrl(JspJavaWriter out, java.lang.String page, java.util.ArrayList<JspParam> params)
           
protected  java.lang.String generateObject(java.lang.Object obj)
           
protected  java.lang.String generateParentTag(TagInstance parent)
          Generates the code for the value of a parent tag.
 void generatePrologue(JspJavaWriter out)
          generates prologue data.
 void generatePrologueChildren(JspJavaWriter out)
          generates data for prologue children.
 void generatePrologueDeclare(JspJavaWriter out)
          generates prologue data.
 void generateStartLocation(JspJavaWriter out)
          Generates the start location.
 void generateStatic(JspJavaWriter out)
          Generates the code for the tag
 void generateTagRelease(JspJavaWriter out)
          generates tag state release
 void generateTagReleaseChildren(JspJavaWriter out)
          generates tag state
 void generateTagState(JspJavaWriter out)
          generates tag state
 void generateTagStateChildren(JspJavaWriter out)
          generates tag state
 java.lang.String getBodyContent()
          Returns the body content.
 java.util.ArrayList<JspNode> getChildren()
          Returns the children.
 java.lang.String getCustomTagName()
          Returns the tag name for the current tag.
 int getEndAttributeLine()
          Gets the attribute ending line number
 int getEndLine()
          Gets the ending line number
 java.lang.String getFilename()
          Gets the filename of the node
 JavaJspGenerator getGenerator()
           
 java.lang.String getJsfBodyVar()
          Returns the variable containing the jsf body
 java.lang.String getJsfVar()
          Returns the variable containing the jsf component
 NamespaceContext getNamespaceContext()
          Returns the XPath namespace context.
 java.lang.String getNamespacePrefix(java.lang.String uri)
          Adds a namespace, e.g.
 JspNode getParent()
          Returns the parent node.
 java.lang.String getParentTagName()
          Returns parent tag node
 JspNode getParentTagNode()
          Returns parent tag node
 QName getQName()
          Returns the qname of the node.
 java.lang.String getRuntimeAttribute(java.lang.String value)
          Returns the runtime attribute of the value.
 JspSegmentNode getSegment()
          Returns the containing segment.
 int getStartLine()
          Gets the starting line number
 java.lang.String getStaticText()
          Returns the static text.
 void getStaticText(CharBuffer cb)
          Returns the static text.
 TagInstance getTag()
          Returns the TagInstance of the enclosing parent.
 java.lang.String getTagName()
          Returns the qname of the node.
 boolean hasCustomTag()
          True if the node contains a child tag.
 boolean hasDeferredAttribute(java.lang.String value)
          Returns true if the value is a runtime attribute.
 boolean hasDeferredAttribute(java.lang.String value, boolean isELIgnored)
          Returns true if the value is a runtime attribute.
 boolean hasELAttribute(java.lang.String value)
          Returns true if the value is a runtime attribute.
 boolean hasELAttribute(java.lang.String value, boolean isELIgnored)
          Returns true if the value is a runtime attribute.
 boolean hasNamespace(QName name)
          Returns true if the namespace decl has been printed.
 boolean hasNamespace(java.lang.String prefix, java.lang.String uri)
          Returns true if the namespace decl has been printed.
 boolean hasRuntimeAttribute(java.lang.String value)
          Returns true if the value is a runtime attribute.
 boolean hasScripting()
          True if the node has scripting (counting rtexpr)
 boolean hasScripting(JspAttribute value)
          Returns true if the string has scripting.
 boolean hasScripting(java.lang.String value)
          Returns true if the string has scripting.
 boolean hasScriptingElement()
          True if the node has scripting element (i.e.
 boolean hasTag()
          True if the node contains a child tag.
protected  java.lang.String invokeFragment(JspFragmentNode frag)
          Generates the code invoking a fragment to a string.
 boolean isInFragment()
          Returns true if in a fragment
 boolean isJsfParentRequired()
          True if the jsf-parent setting is required.
 boolean isJsp21()
          True for 2.1 or later taglib
 boolean isJstl()
          True if this is a jstl node.
 boolean isPre21Taglib()
          Return true for pre-21 taglib.
 boolean isSimpleTag()
          Returns true for a simple tag.
 boolean isStatic()
          True if the node only has static text.
protected  java.lang.Class loadClass(java.lang.String type)
           
 void printJspId(WriteStream os)
          Prints the jsp:id
abstract  void printXml(WriteStream os)
          Generates the XML text representation for the tag validation.
 void printXmlAttribute(WriteStream os, java.lang.String name, java.lang.String text)
          Generates the XML text representation for the tag validation.
protected  java.lang.String printXmlOpen(WriteStream os, java.lang.String ns, java.lang.String localName)
           
 void printXmlText(WriteStream os, java.lang.String text)
          Generates the XML text representation for the tag validation.
 void setEndAttributeLocation(java.lang.String filename, int line)
          Sets the end location of the node.
 void setEndLocation(java.lang.String filename, int line)
          Sets the end location of the node.
 void setGenerator(JavaJspGenerator gen)
          Sets the Java generator.
 void setNamespace(Namespace ns)
          Adds a namespace, e.g.
 void setParent(JspNode parent)
          Sets the parent node
 void setParseState(ParseState parseState)
          Sets the parse state
 void setQName(QName name)
          Sets the node's qname
 void setStartLocation(Path sourcePath, java.lang.String filename, int line)
          Sets the start location of the node.
static java.lang.String toELObject(java.lang.String expr, java.lang.Class<?> type)
           
 java.lang.String toString()
          Returns a printable version of the node.
 java.lang.String xmlAttrText(java.lang.String text)
          Generates the XML text.
 java.lang.String xmlText(java.lang.String text)
          Generates the XML text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_sourcePath

protected Path _sourcePath

_filename

protected java.lang.String _filename

_startLine

protected int _startLine

_endAttributeLine

protected int _endAttributeLine

_endLine

protected int _endLine

_ns

protected Namespace _ns

_gen

protected JavaJspGenerator _gen

_parseState

protected ParseState _parseState

_name

protected QName _name

_parent

protected JspNode _parent
Constructor Detail

JspNode

protected JspNode()
Method Detail

setGenerator

public void setGenerator(JavaJspGenerator gen)
Sets the Java generator.


getGenerator

public JavaJspGenerator getGenerator()

setParseState

public void setParseState(ParseState parseState)
Sets the parse state


getQName

public QName getQName()
Returns the qname of the node.


setQName

public void setQName(QName name)
Sets the node's qname


getTagName

public java.lang.String getTagName()
Returns the qname of the node.


getParent

public JspNode getParent()
Returns the parent node.


setParent

public void setParent(JspNode parent)
Sets the parent node


setStartLocation

public void setStartLocation(Path sourcePath,
                             java.lang.String filename,
                             int line)
Sets the start location of the node.


setEndAttributeLocation

public void setEndAttributeLocation(java.lang.String filename,
                                    int line)
Sets the end location of the node.


setEndLocation

public void setEndLocation(java.lang.String filename,
                           int line)
Sets the end location of the node.


getFilename

public java.lang.String getFilename()
Gets the filename of the node


getStartLine

public int getStartLine()
Gets the starting line number


getEndAttributeLine

public int getEndAttributeLine()
Gets the attribute ending line number


getEndLine

public int getEndLine()
Gets the ending line number


isStatic

public boolean isStatic()
True if the node only has static text.


isJstl

public boolean isJstl()
True if this is a jstl node.


isJsp21

public boolean isJsp21()
True for 2.1 or later taglib


getStaticText

public java.lang.String getStaticText()
Returns the static text.


getStaticText

public void getStaticText(CharBuffer cb)
Returns the static text.


hasScripting

public boolean hasScripting()
True if the node has scripting (counting rtexpr)


hasScriptingElement

public boolean hasScriptingElement()
True if the node has scripting element (i.e. not counting rtexpr values)


findScriptingNode

public JspNode findScriptingNode()
Finds the first scripting node


getBodyContent

public java.lang.String getBodyContent()
Returns the body content.


hasCustomTag

public boolean hasCustomTag()
True if the node contains a child tag.


hasTag

public boolean hasTag()
True if the node contains a child tag.


getCustomTagName

public java.lang.String getCustomTagName()
Returns the tag name for the current tag.


isSimpleTag

public boolean isSimpleTag()
Returns true for a simple tag.


getParentTagNode

public JspNode getParentTagNode()
Returns parent tag node


getParentTagName

public java.lang.String getParentTagName()
Returns parent tag node


hasNamespace

public boolean hasNamespace(java.lang.String prefix,
                            java.lang.String uri)
Returns true if the namespace decl has been printed.


addNamespace

public final void addNamespace(java.lang.String prefix,
                               java.lang.String value)
Adds a namespace, e.g. from a prefix declaration.


setNamespace

public final void setNamespace(Namespace ns)
Adds a namespace, e.g. from a prefix declaration.


getNamespaceContext

public final NamespaceContext getNamespaceContext()
Returns the XPath namespace context.


addNamespaceRec

public void addNamespaceRec(java.lang.String prefix,
                            java.lang.String value)
Adds a namespace, e.g. from a prefix declaration.


getNamespacePrefix

public java.lang.String getNamespacePrefix(java.lang.String uri)
Adds a namespace, e.g. from a prefix declaration.


hasNamespace

public boolean hasNamespace(QName name)
Returns true if the namespace decl has been printed.


addAttribute

public void addAttribute(QName name,
                         java.lang.String value)
                  throws JspParseException
Adds an attribute.

Throws:
JspParseException

addAttribute

public void addAttribute(QName name,
                         JspAttribute value)
                  throws JspParseException
Adds a JspAttribute attribute.

Parameters:
name - the name of the attribute.
value - the value of the attribute.
Throws:
JspParseException

endAttributes

public void endAttributes()
                   throws JspParseException
Called after all the attributes from the tag.

Throws:
JspParseException

addText

public JspNode addText(java.lang.String text)
                throws JspParseException
Adds text.

Throws:
JspParseException

addChild

public void addChild(JspNode node)
              throws JspParseException
Adds a child node.

Throws:
JspParseException

addChildEnd

public void addChildEnd(JspNode node)
                 throws JspParseException
Adds a child node after its completely initialized..

Throws:
JspParseException

endElement

public void endElement()
                throws java.lang.Exception
Called when the tag closes.

Throws:
java.lang.Exception

getChildren

public java.util.ArrayList<JspNode> getChildren()
Returns the children.


getTag

public TagInstance getTag()
Returns the TagInstance of the enclosing parent.


isPre21Taglib

public boolean isPre21Taglib()
Return true for pre-21 taglib.


printXml

public abstract void printXml(WriteStream os)
                       throws java.io.IOException
Generates the XML text representation for the tag validation.

Parameters:
os - write stream to the generated XML.
Throws:
java.io.IOException

printXmlOpen

protected java.lang.String printXmlOpen(WriteStream os,
                                        java.lang.String ns,
                                        java.lang.String localName)
                                 throws java.io.IOException
Throws:
java.io.IOException

printJspId

public void printJspId(WriteStream os)
                throws java.io.IOException
Prints the jsp:id

Throws:
java.io.IOException

printXmlText

public void printXmlText(WriteStream os,
                         java.lang.String text)
                  throws java.io.IOException
Generates the XML text representation for the tag validation.

Parameters:
os - write stream to the generated XML.
Throws:
java.io.IOException

printXmlAttribute

public void printXmlAttribute(WriteStream os,
                              java.lang.String name,
                              java.lang.String text)
                       throws java.io.IOException
Generates the XML text representation for the tag validation.

Parameters:
os - write stream to the generated XML.
Throws:
java.io.IOException

xmlText

public java.lang.String xmlText(java.lang.String text)
Generates the XML text.


xmlAttrText

public java.lang.String xmlAttrText(java.lang.String text)
Generates the XML text.


generateStartLocation

public void generateStartLocation(JspJavaWriter out)
                           throws java.io.IOException
Generates the start location.

Throws:
java.io.IOException

generateEndLocation

public void generateEndLocation(JspJavaWriter out)
                         throws java.io.IOException
Generates the start location.

Throws:
java.io.IOException

generatePrologue

public void generatePrologue(JspJavaWriter out)
                      throws java.lang.Exception
generates prologue data.

Throws:
java.lang.Exception

generatePrologueDeclare

public void generatePrologueDeclare(JspJavaWriter out)
                             throws java.lang.Exception
generates prologue data.

Throws:
java.lang.Exception

generatePrologueChildren

public void generatePrologueChildren(JspJavaWriter out)
                              throws java.lang.Exception
generates data for prologue children.

Throws:
java.lang.Exception

generateDeclaration

public void generateDeclaration(JspJavaWriter out)
                         throws java.io.IOException
generates declaration data.

Throws:
java.io.IOException

generateDeclarationChildren

public void generateDeclarationChildren(JspJavaWriter out)
                                 throws java.io.IOException
generates data for declaration children.

Throws:
java.io.IOException

generateTagState

public void generateTagState(JspJavaWriter out)
                      throws java.lang.Exception
generates tag state

Throws:
java.lang.Exception

generateTagStateChildren

public void generateTagStateChildren(JspJavaWriter out)
                              throws java.lang.Exception
generates tag state

Throws:
java.lang.Exception

generateTagRelease

public void generateTagRelease(JspJavaWriter out)
                        throws java.lang.Exception
generates tag state release

Throws:
java.lang.Exception

generateTagReleaseChildren

public void generateTagReleaseChildren(JspJavaWriter out)
                                throws java.lang.Exception
generates tag state

Throws:
java.lang.Exception

generate

public abstract void generate(JspJavaWriter out)
                       throws java.lang.Exception
Generates the code for the tag

Parameters:
out - the output writer for the generated java.
Throws:
java.lang.Exception

generateChildren

public void generateChildren(JspJavaWriter out)
                      throws java.lang.Exception
Generates the code for the children.

Parameters:
out - the output writer for the generated java.
Throws:
java.lang.Exception

generateClassEpilogue

public void generateClassEpilogue(JspJavaWriter out)
                           throws java.io.IOException
Generates the code for the tag

Parameters:
out - the output writer for the generated java.
Throws:
java.io.IOException

generateClassEpilogueChildren

public void generateClassEpilogueChildren(JspJavaWriter out)
                                   throws java.io.IOException
Generates the code for the tag

Parameters:
out - the output writer for the generated java.
Throws:
java.io.IOException

generateStatic

public void generateStatic(JspJavaWriter out)
                    throws java.lang.Exception
Generates the code for the tag

Parameters:
out - the output writer for the generated java.
Throws:
java.lang.Exception

generateEmpty

public void generateEmpty()
                   throws java.lang.Exception
Generates the code for the tag

Parameters:
out - the output writer for the generated java.
Throws:
java.lang.Exception

generateChildrenEmpty

public void generateChildrenEmpty()
                           throws java.lang.Exception
Generates the code for the children.

Parameters:
out - the output writer for the generated java.
Throws:
java.lang.Exception

attributeToBoolean

protected boolean attributeToBoolean(java.lang.String attr,
                                     java.lang.String value)
                              throws JspParseException
Converts the string to a boolean.

Throws:
JspParseException

isInFragment

public boolean isInFragment()
Returns true if in a fragment


getSegment

public JspSegmentNode getSegment()
Returns the containing segment.


invokeFragment

protected java.lang.String invokeFragment(JspFragmentNode frag)
                                   throws java.lang.Exception
Generates the code invoking a fragment to a string.

Throws:
java.lang.Exception

generateFragment

protected java.lang.String generateFragment(JspFragmentNode frag,
                                            java.lang.String contextVar)
                                     throws java.lang.Exception
Generates the code for a fragment.

Throws:
java.lang.Exception

generateParentTag

protected java.lang.String generateParentTag(TagInstance parent)
                                      throws java.io.IOException
Generates the code for the value of a parent tag.

Throws:
java.io.IOException

getJsfVar

public java.lang.String getJsfVar()
Returns the variable containing the jsf component


getJsfBodyVar

public java.lang.String getJsfBodyVar()
Returns the variable containing the jsf body


isJsfParentRequired

public boolean isJsfParentRequired()
True if the jsf-parent setting is required.


generateIncludeUrl

protected void generateIncludeUrl(JspJavaWriter out,
                                  java.lang.String page,
                                  java.util.ArrayList<JspParam> params)
                           throws java.lang.Exception
Throws:
java.lang.Exception

generateELValue

protected java.lang.String generateELValue(java.lang.Class<?> type,
                                           java.lang.String value)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

convertParameterValue

public void convertParameterValue(JspJavaWriter out,
                                  java.lang.String type,
                                  java.lang.String value)
                           throws java.io.IOException
Throws:
java.io.IOException

classToString

protected java.lang.String classToString(java.lang.Class<?> cl)

hasRuntimeAttribute

public boolean hasRuntimeAttribute(java.lang.String value)
                            throws JspParseException
Returns true if the value is a runtime attribute.

Throws:
JspParseException

hasScripting

public boolean hasScripting(java.lang.String value)
Returns true if the string has scripting.


hasScripting

public boolean hasScripting(JspAttribute value)
Returns true if the string has scripting.


hasELAttribute

public boolean hasELAttribute(java.lang.String value)
Returns true if the value is a runtime attribute.


hasDeferredAttribute

public boolean hasDeferredAttribute(java.lang.String value)
Returns true if the value is a runtime attribute.


hasELAttribute

public boolean hasELAttribute(java.lang.String value,
                              boolean isELIgnored)
Returns true if the value is a runtime attribute.


hasDeferredAttribute

public boolean hasDeferredAttribute(java.lang.String value,
                                    boolean isELIgnored)
Returns true if the value is a runtime attribute.


getRuntimeAttribute

public java.lang.String getRuntimeAttribute(java.lang.String value)
                                     throws java.lang.Exception
Returns the runtime attribute of the value.

Throws:
java.lang.Exception

generateObject

protected java.lang.String generateObject(java.lang.Object obj)

toELObject

public static java.lang.String toELObject(java.lang.String expr,
                                          java.lang.Class<?> type)

escapeJavaString

public static java.lang.String escapeJavaString(java.lang.String s)
Escapes a java string.


loadClass

protected java.lang.Class loadClass(java.lang.String type)
                             throws JspParseException
Throws:
JspParseException

error

protected JspParseException error(java.lang.String msg)
Creates a parse exception with the proper line information.


error

protected JspParseException error(java.lang.String msg,
                                  java.lang.Throwable e)
Creates a parse exception with the proper line information.


error

protected JspParseException error(java.lang.Throwable e)
Creates a parse exception with the proper line information.


toString

public java.lang.String toString()
Returns a printable version of the node.

Overrides:
toString in class java.lang.Object