// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
tomcat.start();
ByteChunk res = getUrl("http://localhost:" + getPort() +
"/test/bug45nnn/bug45451a.jsp");
String result = res.toString();
// Warning: JSP attribute escaping != Java String escaping
assertEcho(result, "00-\\'hello world\\'");
assertEcho(result, "01-\\'hello world\\'");
assertEcho(result, "02-\\'hello world\\'");
assertEcho(result, "03-\\'hello world\\'");
res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45451b.jsp");
result = res.toString();
// Warning: JSP attribute escaping != Java String escaping
// Warning: Attributes are always unescaped before passing to the EL
// processor
assertEcho(result, "00-2");
assertEcho(result, "01-${1+1}");
assertEcho(result, "02-\\${1+1}");
assertEcho(result, "03-\\\\${1+1}");
assertEcho(result, "04-2");
assertEcho(result, "05-${1+1}");
assertEcho(result, "06-\\2");
assertEcho(result, "07-\\${1+1}");
assertEcho(result, "08-\\\\2");
assertEcho(result, "09-2");
assertEcho(result, "10-#{1+1}");
assertEcho(result, "11-\\2");
assertEcho(result, "12-\\#{1+1}");
assertEcho(result, "13-\\\\2");
res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45451c.jsp");
result = res.toString();
// Warning: JSP attribute escaping != Java String escaping
// TODO - Currently we allow a single unescaped \ in attribute values
// Review if this should cause a warning/error
assertEcho(result, "00-${1+1}");
assertEcho(result, "01-\\${1+1}");
assertEcho(result, "02-\\\\${1+1}");
assertEcho(result, "03-\\\\\\${1+1}");
assertEcho(result, "04-${1+1}");
assertEcho(result, "05-\\${1+1}");
assertEcho(result, "06-\\${1+1}");
assertEcho(result, "07-\\\\${1+1}");
assertEcho(result, "08-\\\\${1+1}");
assertEcho(result, "09-#{1+1}");
assertEcho(result, "10-\\#{1+1}");
assertEcho(result, "11-\\#{1+1}");
assertEcho(result, "12-\\\\#{1+1}");
assertEcho(result, "13-\\\\#{1+1}");
res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45451d.jspx");
result = res.toString();
// Warning: JSP attribute escaping != Java String escaping
// \\ Is *not* an escape sequence in XML attributes
assertEcho(result, "00-2");
assertEcho(result, "01-${1+1}");
assertEcho(result, "02-\\${1+1}");
assertEcho(result, "03-\\\\${1+1}");
assertEcho(result, "04-2");
assertEcho(result, "05-${1+1}");
assertEcho(result, "06-\\${1+1}");
assertEcho(result, "07-\\\\${1+1}");
assertEcho(result, "08-\\\\\\${1+1}");
assertEcho(result, "09-2");
assertEcho(result, "10-#{1+1}");
assertEcho(result, "11-\\#{1+1}");
assertEcho(result, "12-\\\\#{1+1}");
assertEcho(result, "13-\\\\\\#{1+1}");
res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45451e.jsp");
result = res.toString();
// Warning: JSP attribute escaping != Java String escaping
// Warning: Attributes are always unescaped before passing to the EL
// processor
assertEcho(result, "00-2");
assertEcho(result, "01-${1+1}");