public class JavaJspGenerator extends JspGenerator
JspParser parses the JSP file into an XML-DOM tree. JspGenerator generates code from that tree.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList<Depend> |
_cacheDepends |
protected java.lang.String |
_className |
protected JspPageConfig |
_config |
protected java.util.ArrayList<JspDeclaration> |
_declarations |
protected java.util.ArrayList<PersistentDependency> |
_depends |
protected java.lang.String |
_fullClassName |
protected boolean |
_ideHack |
protected boolean |
_isCacheable |
protected boolean |
_isUncacheable |
protected ParseState |
_parseState |
protected java.lang.String |
_pkg |
protected JspNode |
_rootNode |
protected IntMap |
_strings |
protected int |
_tagId |
protected ParseTagManager |
_tagManager |
protected TagInstance |
_topTag |
_jspBuilder, _jspCompiler, _jspCompilerInstance, _jspParser, _lineMap| Constructor and Description |
|---|
JavaJspGenerator(ParseTagManager tagManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
addBeanClass(java.lang.String id,
java.lang.String typeName)
Saves a bean's class for later introspection.
|
void |
addDeclaration(JspDeclaration decl)
Adds a new Java declaration to the list.
|
void |
addDeclared(java.lang.String var)
Adds a declared variable.
|
void |
addDepend(java.lang.Class<?> cl)
Adds a dependency based on a class.
|
void |
addDepend(Path path) |
void |
addDepend(PersistentDependency depend) |
int |
addExpr(java.lang.String expr)
Adds an expression to the expression list.
|
int |
addFragment(JspFragmentNode node) |
protected void |
addImport(java.lang.String name) |
int |
addMethodExpr(java.lang.String value,
java.lang.String sigString)
Adds an expression to the expression list.
|
void |
addOptionalTaglib(java.lang.String prefix,
java.lang.String uri)
Adds a taglib.
|
int |
addString(java.lang.String string) |
Taglib |
addTaglib(QName qname) |
void |
addTaglib(java.lang.String prefix,
java.lang.String uri)
Adds a taglib.
|
Taglib |
addTaglib(java.lang.String prefix,
java.lang.String uri,
boolean isOptional)
Adds a taglib.
|
void |
addTaglibDir(java.lang.String prefix,
java.lang.String tagdir)
Adds a taglib.
|
int |
addValueExpr(java.lang.String value,
java.lang.String type)
Adds an expression to the expression list.
|
java.lang.String |
addXPathExpr(Expr expr)
Adds an expression to the expression list.
|
java.lang.String |
addXPathExpr(java.lang.String value,
NamespaceContext ns)
Adds an expression to the expression list.
|
JspParseException |
error(java.lang.Exception e) |
JspParseException |
error(java.lang.String message) |
protected void |
fillSingleTaglibImports()
As a convenience, when the Tag isn't in a package, import
it automatically.
|
protected void |
generate(JspJavaWriter out)
Generates the Java code.
|
protected void |
generate(Path path,
java.lang.String className)
Generates the JSP page.
|
protected void |
generateClassFooter(JspJavaWriter out)
Completes the generated class: closing the main method, generating
the dependencies and generating the constant strings.
|
protected void |
generateClassHeader(JspJavaWriter out)
Generates the class header.
|
int |
generateJspId() |
protected void |
generatePageFooter(JspJavaWriter out) |
protected void |
generatePageHeader(JspJavaWriter out)
Prints the _jspService header
|
protected void |
generateStatic()
Generates a static file.
|
Expr |
genExpr(java.lang.String value) |
java.lang.Class<?> |
getBeanClass(java.lang.String typeName)
Loads a bean based on the class name.
|
java.lang.Class<?> |
getClass(java.lang.String id) |
JspPageConfig |
getConfig() |
java.util.ArrayList<PersistentDependency> |
getDependList() |
ELContext |
getELContext() |
JspFragmentNode |
getFragment(int index) |
PageData |
getPageData()
Returns the page's XML view.
|
ParseState |
getParseState() |
boolean |
getRecycleTags() |
TagInstance |
getRootTag() |
java.lang.String |
getSourceLines(Path source,
int errorLine) |
TagInfo |
getTag(QName qname)
Returns the tag with the given qname.
|
java.lang.Class<?> |
getTagClass(QName qname)
Returns the tag with the given qname.
|
ParseTagManager |
getTagManager()
Returns the taglib manager.
|
boolean |
hasScripting() |
void |
init() |
protected void |
init(java.lang.String className) |
boolean |
isDeclared(java.lang.String var)
True if it's a declared variable.
|
boolean |
isJsfPrologueInit() |
boolean |
isPre21()
True for a pre jsp21 tag
|
boolean |
isPrototype() |
boolean |
isStatic()
Returns true if the JSP compilation has produced a static file.
|
boolean |
isStaticEncoding() |
boolean |
isTag() |
void |
setJsfPrologueInit(boolean isInit) |
void |
setPageConfig(JspPageConfig pageConfig) |
protected void |
setParseState(ParseState parseState) |
void |
setRootNode(JspNode node)
Sets the root JSP node.
|
void |
setTagManager(ParseTagManager tagManager)
Sets the taglib manager.
|
int |
uniqueId() |
void |
validate()
Validates the JSP page.
|
generateTagInfo, getJspBuilder, getJspCompiler, getJspCompilerInstance, getJspParser, getLineMap, isELIgnore, isTagDependent, setJspBuilder, setJspCompiler, setJspCompilerInstance, setJspParserprotected JspNode _rootNode
protected ParseState _parseState
protected boolean _ideHack
protected boolean _isCacheable
protected boolean _isUncacheable
protected java.util.ArrayList<Depend> _cacheDepends
protected java.util.ArrayList<PersistentDependency> _depends
protected TagInstance _topTag
protected int _tagId
protected ParseTagManager _tagManager
protected JspPageConfig _config
protected java.lang.String _fullClassName
protected java.lang.String _className
protected IntMap _strings
protected java.lang.String _pkg
protected java.util.ArrayList<JspDeclaration> _declarations
public JavaJspGenerator(ParseTagManager tagManager)
public TagInstance getRootTag()
protected void setParseState(ParseState parseState)
setParseState in class JspGeneratorpublic ParseState getParseState()
getParseState in class JspGeneratorpublic void setPageConfig(JspPageConfig pageConfig)
public void setRootNode(JspNode node)
public JspPageConfig getConfig()
public boolean isTag()
public void init()
public boolean hasScripting()
public boolean isJsfPrologueInit()
public void setJsfPrologueInit(boolean isInit)
public void addTaglib(java.lang.String prefix,
java.lang.String uri)
throws JspParseException
JspParseExceptionpublic boolean isPre21()
public boolean isPrototype()
public void addOptionalTaglib(java.lang.String prefix,
java.lang.String uri)
throws JspParseException
JspParseExceptionpublic Taglib addTaglib(java.lang.String prefix, java.lang.String uri, boolean isOptional) throws JspParseException
JspParseExceptionpublic void addTaglibDir(java.lang.String prefix,
java.lang.String tagdir)
throws JspParseException
JspParseExceptionpublic boolean isStatic()
isStatic in class JspGeneratorpublic PageData getPageData() throws java.io.IOException
java.io.IOExceptionpublic ELContext getELContext()
public void validate()
throws java.lang.Exception
validate in class JspGeneratorjava.lang.Exceptionprotected void generate(Path path, java.lang.String className) throws java.lang.Exception
generate in class JspGeneratorjava.lang.Exceptionpublic void addDepend(Path path)
public void addDepend(java.lang.Class<?> cl)
public void addDepend(PersistentDependency depend)
addDepend in class JspGeneratorpublic java.util.ArrayList<PersistentDependency> getDependList()
getDependList in class JspGeneratorpublic boolean isStaticEncoding()
public boolean getRecycleTags()
public void addDeclaration(JspDeclaration decl)
public void setTagManager(ParseTagManager tagManager)
public ParseTagManager getTagManager()
protected void init(java.lang.String className)
public boolean isDeclared(java.lang.String var)
public void addDeclared(java.lang.String var)
protected void generate(JspJavaWriter out) throws java.lang.Exception
java.lang.Exceptionprotected void generateStatic()
throws java.lang.Exception
java.lang.Exceptionprotected void generateClassHeader(JspJavaWriter out) throws java.io.IOException, JspParseException
doc - the XML document representing the JSP page.java.io.IOExceptionJspParseExceptionprotected void fillSingleTaglibImports()
throws JspParseException
JspParseExceptionprotected void generatePageHeader(JspJavaWriter out) throws java.lang.Exception
java.lang.Exceptionpublic int addString(java.lang.String string)
public void addBeanClass(java.lang.String id,
java.lang.String typeName)
throws java.lang.Exception
id - the bean idtypeName - the bean's typejava.lang.Exceptionpublic java.lang.Class<?> getBeanClass(java.lang.String typeName)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic java.lang.Class<?> getClass(java.lang.String id)
protected void generatePageFooter(JspJavaWriter out) throws java.io.IOException
java.io.IOExceptionprotected void generateClassFooter(JspJavaWriter out) throws java.lang.Exception
doc - the XML document representing the JSP page.java.lang.Exceptionpublic int addFragment(JspFragmentNode node)
public JspFragmentNode getFragment(int index)
public Expr genExpr(java.lang.String value) throws JspParseException, ELException
JspParseExceptionELExceptionpublic int addExpr(java.lang.String expr)
throws JspParseException,
ELException
JspParseExceptionELExceptionpublic int addValueExpr(java.lang.String value,
java.lang.String type)
throws JspParseException,
ELException
JspParseExceptionELExceptionpublic int addMethodExpr(java.lang.String value,
java.lang.String sigString)
throws JspParseException,
ELException
JspParseExceptionELExceptionpublic java.lang.String addXPathExpr(java.lang.String value,
NamespaceContext ns)
throws JspParseException,
XPathParseException
JspParseExceptionXPathParseExceptionpublic java.lang.String addXPathExpr(Expr expr) throws JspParseException
JspParseExceptionpublic int uniqueId()
uniqueId in class JspGeneratorpublic int generateJspId()
protected void addImport(java.lang.String name)
public TagInfo getTag(QName qname) throws JspParseException
JspParseExceptionpublic java.lang.Class<?> getTagClass(QName qname) throws java.lang.Exception
java.lang.Exceptionpublic Taglib addTaglib(QName qname) throws JspParseException
JspParseExceptionpublic java.lang.String getSourceLines(Path source, int errorLine)
getSourceLines in class JspGeneratorpublic JspParseException error(java.lang.String message)
public JspParseException error(java.lang.Exception e)