Skip to content

Commit

Permalink
Merge pull request #38 from treblereel/UNDERTOW-1319
Browse files Browse the repository at this point in the history
[UNDERTOW-1319] Partial use of scriptlet expression in jsp:include do…
  • Loading branch information
stuartwdouglas committed Sep 4, 2018
2 parents a192df2 + 3a7f68c commit b8f24dc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/org/apache/jasper/compiler/Validator.java
Expand Up @@ -1337,6 +1337,11 @@ private Node.JspAttribute getJspAttribute(TagAttributeInfo tai,
result = new Node.JspAttribute(tai, qName, uri, localName,
value.substring(3, value.length() - 2), true, null,
dynamic);
}else if(!n.getRoot().isXmlSyntax()
&& value.contains("<%=") && value.contains("%>") && (value.indexOf("<%=") < value.indexOf("%>"))) {
result = new Node.JspAttribute(tai, qName, uri, localName,
partialScriptletExpression(value), true, null,
dynamic);
} else {
if (!pageInfo.isELIgnored()) {
// The attribute can contain expressions but is not a
Expand Down Expand Up @@ -1417,6 +1422,16 @@ private Node.JspAttribute getJspAttribute(TagAttributeInfo tai,
return result;
}

// [UNDERTOW-1319]
private String partialScriptletExpression(String url) {
String result = "\"" + url.replaceAll("<%=", "\"+").replaceAll("%>", "+\"");
if (result.lastIndexOf("+\"") == result.length() - 2) {
return result.substring(0, result.length() - 2);
} else {
return result + "\"";
}
}


private static class XmlEscapeNonELVisitor extends ELParser.TextBuilder {

Expand Down

0 comments on commit b8f24dc

Please sign in to comment.