use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.
the class TestELInJsp method testBug51544.
@Test
public void testBug51544() throws Exception {
getTomcatInstanceTestWebapp(false, true);
ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug51544.jsp");
String result = res.toString();
assertEcho(result, "Empty list: true");
}
use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.
the class TestELInJsp method testBug45451.
@Test
public void testBug45451() throws Exception {
getTomcatInstanceTestWebapp(false, true);
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-$500");
// Inside an EL literal '\' is only used to escape '\', ''' and '"'
assertEcho(result, "05-\\$");
assertEcho(result, "06-\\${");
assertEcho(result, "10-2");
assertEcho(result, "11-${1+1}");
assertEcho(result, "12-\\2");
assertEcho(result, "13-\\${1+1}");
assertEcho(result, "14-\\\\2");
assertEcho(result, "15-$500");
assertEcho(result, "16-\\$");
assertEcho(result, "17-\\${");
assertEcho(result, "20-2");
assertEcho(result, "21-#{1+1}");
assertEcho(result, "22-\\2");
assertEcho(result, "23-\\#{1+1}");
assertEcho(result, "24-\\\\2");
assertEcho(result, "25-\\#");
assertEcho(result, "26-\\#{");
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-\\$500");
assertEcho(result, "10-${1+1}");
assertEcho(result, "11-\\${1+1}");
assertEcho(result, "12-\\${1+1}");
assertEcho(result, "13-\\\\${1+1}");
assertEcho(result, "14-\\\\${1+1}");
assertEcho(result, "15-\\$500");
assertEcho(result, "20-#{1+1}");
assertEcho(result, "21-\\#{1+1}");
assertEcho(result, "22-\\#{1+1}");
assertEcho(result, "23-\\\\#{1+1}");
assertEcho(result, "24-\\\\#{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-$500");
assertEcho(result, "10-2");
assertEcho(result, "11-${1+1}");
assertEcho(result, "12-\\${1+1}");
assertEcho(result, "13-\\\\${1+1}");
assertEcho(result, "14-\\\\\\${1+1}");
assertEcho(result, "15-$500");
assertEcho(result, "20-2");
assertEcho(result, "21-#{1+1}");
assertEcho(result, "22-\\#{1+1}");
assertEcho(result, "23-\\\\#{1+1}");
assertEcho(result, "24-\\\\\\#{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}");
assertEcho(result, "02-\\${1+1}");
assertEcho(result, "03-\\\\${1+1}");
assertEcho(result, "04-$500");
assertEcho(result, "10-2");
assertEcho(result, "11-${1+1}");
assertEcho(result, "12-\\2");
assertEcho(result, "13-\\${1+1}");
assertEcho(result, "14-\\\\2");
assertEcho(result, "15-$500");
assertEcho(result, "20-#{1+1}");
assertEcho(result, "21-\\#{1+1}");
assertEcho(result, "22-\\#{1+1}");
assertEcho(result, "23-\\\\#{1+1}");
assertEcho(result, "24-\\\\#{1+1}");
}
use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.
the class TestELInJsp method testBug57141.
/*
* java.lang should be imported by default
*/
@Test
public void testBug57141() throws Exception {
getTomcatInstanceTestWebapp(false, true);
ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug5nnnn/bug57141.jsp");
String result = res.toString();
assertEcho(result, "00-true");
assertEcho(result, "01-false");
assertEcho(result, "02-2147483647");
}
use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.
the class TestELInJsp method testScriptingExpression.
@Test
public void testScriptingExpression() throws Exception {
getTomcatInstanceTestWebapp(false, true);
ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/script-expr.jsp");
String result = res.toString();
assertEcho(result, "00-hello world");
assertEcho(result, "01-hello \"world");
assertEcho(result, "02-hello \\\"world");
assertEcho(result, "03-hello ${world");
assertEcho(result, "04-hello \\${world");
assertEcho(result, "05-hello world");
assertEcho(result, "06-hello \"world");
assertEcho(result, "07-hello \\\"world");
assertEcho(result, "08-hello ${world");
assertEcho(result, "09-hello \\${world");
assertEcho(result, "10-hello <% world");
assertEcho(result, "11-hello %> world");
}
use of org.apache.tomcat.util.buf.ByteChunk in project tomcat by apache.
the class TestELInJsp method testBug45511.
@Test
public void testBug45511() throws Exception {
getTomcatInstanceTestWebapp(false, true);
ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug45nnn/bug45511.jsp");
String result = res.toString();
assertEcho(result, "00-true");
assertEcho(result, "01-false");
}
Aggregations