Package org.apache.jasper.compiler
Class Validator.ValidateVisitor
- java.lang.Object
-
- org.apache.jasper.compiler.Node.Visitor
-
- org.apache.jasper.compiler.Validator.ValidateVisitor
-
- Enclosing class:
- Validator
static class Validator.ValidateVisitor extends Node.Visitor
A visitor for validating nodes other than page directives
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Validator.ValidateVisitor.NamedAttributeVisitor
-
Field Summary
Fields Modifier and Type Field Description private static JspUtil.ValidAttribute[]
attributeAttrs
private JspCompilationContext
ctxt
private static JspUtil.ValidAttribute[]
doBodyAttrs
private ErrorDispatcher
err
private static JspUtil.ValidAttribute[]
forwardActionAttrs
private static JspUtil.ValidAttribute[]
getPropertyAttrs
private static JspUtil.ValidAttribute[]
includeActionAttrs
private static JspUtil.ValidAttribute[]
includeDirectiveAttrs
private static JspUtil.ValidAttribute[]
invokeAttrs
private static JspUtil.ValidAttribute[]
jspOutputAttrs
private static JspUtil.ValidAttribute[]
jspRootAttrs
private java.lang.ClassLoader
loader
private PageInfo
pageInfo
private static JspUtil.ValidAttribute[]
paramActionAttrs
private static JspUtil.ValidAttribute[]
plugInAttrs
private static JspUtil.ValidAttribute[]
setPropertyAttrs
private static JspUtil.ValidAttribute[]
taglibDirectiveAttrs
private static JspUtil.ValidAttribute[]
useBeanAttrs
-
Constructor Summary
Constructors Constructor Description ValidateVisitor(Compiler compiler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkNamedAttributes(Node.CustomTag n, Node.JspAttribute[] jspAttrs, int start, java.util.Hashtable<java.lang.String,java.lang.Object> tagDataAttrs)
private void
checkSetter(Node.CustomTag n, TagAttributeInfo tldattr)
private void
checkXmlAttributes(Node.CustomTag n, Node.JspAttribute[] jspAttrs, java.util.Hashtable<java.lang.String,java.lang.Object> tagDataAttrs)
private java.lang.String
escapePound(java.lang.String value)
private java.lang.String
findUri(java.lang.String prefix, Node n)
private javax.el.FunctionMapper
getFunctionMapper(ELNode.Nodes el)
private Node.JspAttribute
getJspAttribute(java.lang.String qName, java.lang.String uri, java.lang.String localName, java.lang.String value, Node n, boolean dynamic, TagAttributeInfo tagAttr)
Preprocess attributes that can be expressions.private java.lang.String
getLiteral(Node n, java.lang.String value)
private java.lang.String
getMethod(java.lang.String signature)
Get the method name from the signature.private java.lang.String[]
getParameters(java.lang.String signature)
Get the parameters types from the function signature.private java.lang.String
getReturnType(java.lang.String signature)
Get the return type from the signature.private void
processSignature(ELNode.Function func)
private void
throwErrorIfExpression(Node n, java.lang.String attrName, java.lang.String actionName)
private void
validateFunctions(ELNode.Nodes el, Node n)
Validate functions in EL expressionsvoid
visit(Node.CustomTag n)
void
visit(Node.Declaration n)
void
visit(Node.DoBodyAction n)
void
visit(Node.ELExpression n)
void
visit(Node.Expression n)
void
visit(Node.ForwardAction n)
void
visit(Node.GetProperty n)
void
visit(Node.IncludeAction n)
void
visit(Node.IncludeDirective n)
void
visit(Node.InvokeAction n)
void
visit(Node.JspBody n)
void
visit(Node.JspElement n)
void
visit(Node.JspOutput n)
void
visit(Node.JspRoot n)
void
visit(Node.NamedAttribute n)
void
visit(Node.ParamAction n)
void
visit(Node.ParamsAction n)
void
visit(Node.PlugIn n)
void
visit(Node.Scriptlet n)
void
visit(Node.SetProperty n)
void
visit(Node.TaglibDirective n)
void
visit(Node.UninterpretedTag n)
void
visit(Node.UseBean n)
-
-
-
Field Detail
-
pageInfo
private PageInfo pageInfo
-
err
private ErrorDispatcher err
-
loader
private java.lang.ClassLoader loader
-
ctxt
private JspCompilationContext ctxt
-
jspRootAttrs
private static final JspUtil.ValidAttribute[] jspRootAttrs
-
includeDirectiveAttrs
private static final JspUtil.ValidAttribute[] includeDirectiveAttrs
-
taglibDirectiveAttrs
private static final JspUtil.ValidAttribute[] taglibDirectiveAttrs
-
includeActionAttrs
private static final JspUtil.ValidAttribute[] includeActionAttrs
-
paramActionAttrs
private static final JspUtil.ValidAttribute[] paramActionAttrs
-
forwardActionAttrs
private static final JspUtil.ValidAttribute[] forwardActionAttrs
-
getPropertyAttrs
private static final JspUtil.ValidAttribute[] getPropertyAttrs
-
setPropertyAttrs
private static final JspUtil.ValidAttribute[] setPropertyAttrs
-
useBeanAttrs
private static final JspUtil.ValidAttribute[] useBeanAttrs
-
plugInAttrs
private static final JspUtil.ValidAttribute[] plugInAttrs
-
attributeAttrs
private static final JspUtil.ValidAttribute[] attributeAttrs
-
invokeAttrs
private static final JspUtil.ValidAttribute[] invokeAttrs
-
doBodyAttrs
private static final JspUtil.ValidAttribute[] doBodyAttrs
-
jspOutputAttrs
private static final JspUtil.ValidAttribute[] jspOutputAttrs
-
-
Constructor Detail
-
ValidateVisitor
ValidateVisitor(Compiler compiler)
-
-
Method Detail
-
visit
public void visit(Node.JspRoot n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.IncludeDirective n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.TaglibDirective n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.ParamAction n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.ParamsAction n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.IncludeAction n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.ForwardAction n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.GetProperty n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.SetProperty n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.UseBean n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.PlugIn n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.NamedAttribute n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.JspBody n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.Declaration n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.Expression n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.Scriptlet n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.ELExpression n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.UninterpretedTag n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.CustomTag n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.JspElement n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.JspOutput n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.InvokeAction n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
visit
public void visit(Node.DoBodyAction n) throws JasperException
- Overrides:
visit
in classNode.Visitor
- Throws:
JasperException
-
checkSetter
private void checkSetter(Node.CustomTag n, TagAttributeInfo tldattr) throws JasperException
- Throws:
JasperException
-
checkXmlAttributes
private void checkXmlAttributes(Node.CustomTag n, Node.JspAttribute[] jspAttrs, java.util.Hashtable<java.lang.String,java.lang.Object> tagDataAttrs) throws JasperException
- Throws:
JasperException
-
checkNamedAttributes
private void checkNamedAttributes(Node.CustomTag n, Node.JspAttribute[] jspAttrs, int start, java.util.Hashtable<java.lang.String,java.lang.Object> tagDataAttrs) throws JasperException
- Throws:
JasperException
-
getJspAttribute
private Node.JspAttribute getJspAttribute(java.lang.String qName, java.lang.String uri, java.lang.String localName, java.lang.String value, Node n, boolean dynamic, TagAttributeInfo tagAttr) throws JasperException
Preprocess attributes that can be expressions. Expression delimiters are stripped.If value is null, checks if there are any NamedAttribute subelements in the tree node, and if so, constructs a JspAttribute out of a child NamedAttribute node.
- Throws:
JasperException
-
getLiteral
private java.lang.String getLiteral(Node n, java.lang.String value)
-
throwErrorIfExpression
private void throwErrorIfExpression(Node n, java.lang.String attrName, java.lang.String actionName) throws JasperException
- Throws:
JasperException
-
escapePound
private java.lang.String escapePound(java.lang.String value)
-
findUri
private java.lang.String findUri(java.lang.String prefix, Node n)
-
validateFunctions
private void validateFunctions(ELNode.Nodes el, Node n) throws JasperException
Validate functions in EL expressions- Throws:
JasperException
-
processSignature
private void processSignature(ELNode.Function func) throws JasperException
- Throws:
JasperException
-
getReturnType
private java.lang.String getReturnType(java.lang.String signature) throws JasperException
Get the return type from the signature.- Throws:
JasperException
-
getMethod
private java.lang.String getMethod(java.lang.String signature) throws JasperException
Get the method name from the signature.- Throws:
JasperException
-
getParameters
private java.lang.String[] getParameters(java.lang.String signature) throws JasperException
Get the parameters types from the function signature.- Returns:
- An array of parameter class names
- Throws:
JasperException
-
getFunctionMapper
private javax.el.FunctionMapper getFunctionMapper(ELNode.Nodes el) throws JasperException
- Throws:
JasperException
-
-