import javax.el.ExpressionFactory;
import javax.el.FunctionMapper;
import javax.servlet.jsp.tagext.FunctionInfo;
-import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.PageData;
import javax.servlet.jsp.tagext.TagAttributeInfo;
import javax.servlet.jsp.tagext.TagData;
// request-time expression
throwErrorIfExpression(n, "name", "jsp:param");
n.setValue(getJspAttribute(null, "value", null, null, n
- .getAttributeValue("value"), java.lang.String.class, n,
- false));
+ .getAttributeValue("value"), n, false));
visitBody(n);
}
JspUtil.checkAttributes("Include action", n, includeActionAttrs,
err);
n.setPage(getJspAttribute(null, "page", null, null, n
- .getAttributeValue("page"), java.lang.String.class, n,
- false));
+ .getAttributeValue("page"), n, false));
visitBody(n);
- };
+ }
public void visit(Node.ForwardAction n) throws JasperException {
JspUtil.checkAttributes("Forward", n, forwardActionAttrs, err);
n.setPage(getJspAttribute(null, "page", null, null, n
- .getAttributeValue("page"), java.lang.String.class, n,
- false));
+ .getAttributeValue("page"), n, false));
visitBody(n);
}
String value = n.getAttributeValue("value");
n.setValue(getJspAttribute(null, "value", null, null, value,
- java.lang.Object.class, n, false));
+ n, false));
boolean valueSpecified = n.getValue() != null;
err.jspError(n, "jsp.error.usebean.noSession");
Node.JspAttribute jattr = getJspAttribute(null, "beanName", null,
- null, n.getAttributeValue("beanName"),
- java.lang.String.class, n, false);
+ null, n.getAttributeValue("beanName"), n, false);
n.setBeanName(jattr);
if (className != null && jattr != null)
err.jspError(n, "jsp.error.usebean.notBoth");
err.jspError(n, "jsp.error.plugin.nocode");
Node.JspAttribute width = getJspAttribute(null, "width", null,
- null, n.getAttributeValue("width"), java.lang.String.class,
- n, false);
+ null, n.getAttributeValue("width"), n, false);
n.setWidth(width);
Node.JspAttribute height = getJspAttribute(null, "height", null,
- null, n.getAttributeValue("height"),
- java.lang.String.class, n, false);
+ null, n.getAttributeValue("height"), n, false);
n.setHeight(height);
visitBody(n);
for (int i = 0; i < attrSize; i++) {
jspAttrs[i] = getJspAttribute(null, attrs.getQName(i),
attrs.getURI(i), attrs.getLocalName(i), attrs
- .getValue(i), java.lang.Object.class, n,
- false);
+ .getValue(i), n, false);
}
n.setJspAttributes(jspAttrs);
}
if ("name".equals(attrs.getLocalName(i))) {
n.setNameAttribute(getJspAttribute(null, attrs.getQName(i),
attrs.getURI(i), attrs.getLocalName(i), attrs
- .getValue(i), java.lang.String.class, n,
- false));
+ .getValue(i), n, false));
} else {
if (jspAttrIndex < jspAttrSize) {
jspAttrs[jspAttrIndex++] = getJspAttribute(null, attrs
.getQName(i), attrs.getURI(i), attrs
- .getLocalName(i), attrs.getValue(i),
- java.lang.Object.class, n, false);
+ .getLocalName(i), attrs.getValue(i), n, false);
}
}
}
expectedType = tldAttrs[j].getExpectedTypeName();
}
if (expectedType != null) {
- Class expectedClass = String.class;
+ Class<?> expectedClass = String.class;
try {
expectedClass = JspUtil.toClass(expectedType, loader);
} catch (ClassNotFoundException e) {
tldAttrs[j].getName());
}
- Class expectedType = String.class;
- try {
- String typeStr = tldAttrs[j].getTypeName();
- if (tldAttrs[j].isFragment()) {
- expectedType = JspFragment.class;
- } else if (typeStr != null) {
- expectedType = JspUtil.toClass(typeStr,
- loader);
- }
- if (elExpression) {
- // El expression
- validateFunctions(el, n);
- jspAttrs[i] = new Node.JspAttribute(tldAttrs[j],
- attrs.getQName(i), attrs.getURI(i),
- attrs.getLocalName(i),
- attrs.getValue(i), false, el, false);
- ELContextImpl ctx = new ELContextImpl();
- ctx.setFunctionMapper(getFunctionMapper(el));
- try {
- jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx);
- } catch (ELException e) {
- this.err.jspError(n.getStart(),
- "jsp.error.invalid.expression",
- attrs.getValue(i), e.toString());
- }
- } else {
- // Runtime expression
- jspAttrs[i] = getJspAttribute(tldAttrs[j],
- attrs.getQName(i), attrs.getURI(i),
- attrs.getLocalName(i), attrs
- .getValue(i), expectedType, n,
- false);
+ if (elExpression) {
+ // El expression
+ validateFunctions(el, n);
+ jspAttrs[i] = new Node.JspAttribute(tldAttrs[j],
+ attrs.getQName(i), attrs.getURI(i),
+ attrs.getLocalName(i),
+ attrs.getValue(i), false, el, false);
+ ELContextImpl ctx = new ELContextImpl();
+ ctx.setFunctionMapper(getFunctionMapper(el));
+ try {
+ jspAttrs[i].validateEL(this.pageInfo.getExpressionFactory(), ctx);
+ } catch (ELException e) {
+ this.err.jspError(n.getStart(),
+ "jsp.error.invalid.expression",
+ attrs.getValue(i), e.toString());
}
- } catch (ClassNotFoundException e) {
- err.jspError
- (n, "jsp.error.unknown_attribute_type",
- tldAttrs[j].getName(), tldAttrs[j].getTypeName());
+ } else {
+ // Runtime expression
+ jspAttrs[i] = getJspAttribute(tldAttrs[j],
+ attrs.getQName(i), attrs.getURI(i),
+ attrs.getLocalName(i), attrs
+ .getValue(i), n, false);
}
}
if (tagInfo.hasDynamicAttributes()) {
jspAttrs[i] = getJspAttribute(null, attrs.getQName(i),
attrs.getURI(i), attrs.getLocalName(i), attrs
- .getValue(i), java.lang.Object.class,
- n, true);
+ .getValue(i), n, true);
} else {
err.jspError(n, "jsp.error.bad_attribute", attrs
.getQName(i), n.getLocalName());
*/
private Node.JspAttribute getJspAttribute(TagAttributeInfo tai,
String qName, String uri, String localName, String value,
- Class expectedType, Node n, boolean dynamic)
+ Node n, boolean dynamic)
throws JasperException {
Node.JspAttribute result = null;
}
start = p + 1;
}
- return (String[]) params.toArray(new String[params.size()]);
+ return params.toArray(new String[params.size()]);
}
private FunctionMapper getFunctionMapper(ELNode.Nodes el)
public void visit(ELNode.Function n) throws JasperException {
- Class c = null;
+ Class<?> c = null;
Method method = null;
try {
c = loader.loadClass(n.getFunctionInfo()
}
String paramTypes[] = n.getParameters();
int size = paramTypes.length;
- Class params[] = new Class[size];
+ Class<?> params[] = new Class[size];
int i = 0;
try {
for (i = 0; i < size; i++) {