(boolean quoteAttributeEL)
| 300 | } |
| 301 | |
| 302 | private void doTestELMisc(boolean quoteAttributeEL) throws Exception { |
| 303 | Tomcat tomcat = getTomcatInstance(); |
| 304 | |
| 305 | // Create the context (don't use addWebapp as we want to modify the |
| 306 | // JSP Servlet settings). |
| 307 | File appDir = new File("test/webapp"); |
| 308 | StandardContext ctxt = (StandardContext) tomcat.addContext(null, "/test", appDir.getAbsolutePath()); |
| 309 | |
| 310 | ctxt.addServletContainerInitializer(new JasperInitializer(), null); |
| 311 | |
| 312 | // Configure the defaults and then tweak the JSP servlet settings |
| 313 | // Note: Min value for maxLoadedJsps is 2 |
| 314 | Tomcat.initWebappDefaults(ctxt); |
| 315 | Wrapper w = (Wrapper) ctxt.findChild("jsp"); |
| 316 | |
| 317 | String jspName; |
| 318 | if (quoteAttributeEL) { |
| 319 | jspName = "/test/el-misc-with-quote-attribute-el.jsp"; |
| 320 | w.addInitParameter("quoteAttributeEL", "true"); |
| 321 | } else { |
| 322 | jspName = "/test/el-misc-no-quote-attribute-el.jsp"; |
| 323 | w.addInitParameter("quoteAttributeEL", "false"); |
| 324 | } |
| 325 | |
| 326 | tomcat.start(); |
| 327 | |
| 328 | ByteChunk res = getUrl("http://localhost:" + getPort() + jspName); |
| 329 | String result = res.toString(); |
| 330 | |
| 331 | assertEcho(result, "00-\\\\\\\"${'hello world'}"); |
| 332 | assertEcho(result, "01-\\\\\\\"\\${'hello world'}"); |
| 333 | assertEcho(result, "02-\\\"${'hello world'}"); |
| 334 | assertEcho(result, "03-\\\"\\hello world"); |
| 335 | assertEcho(result, "2az-04"); |
| 336 | assertEcho(result, "05-a2z"); |
| 337 | assertEcho(result, "06-az2"); |
| 338 | assertEcho(result, "2az-07"); |
| 339 | assertEcho(result, "08-a2z"); |
| 340 | assertEcho(result, "09-az2"); |
| 341 | assertEcho(result, "10-${'foo'}bar"); |
| 342 | assertEcho(result, "11-\\\"}"); |
| 343 | assertEcho(result, "12-foo\\bar\\baz"); |
| 344 | assertEcho(result, "13-foo\\bar\\baz"); |
| 345 | assertEcho(result, "14-foo\\bar\\baz"); |
| 346 | assertEcho(result, "15-foo\\bar\\baz"); |
| 347 | assertEcho(result, "16-foo\\bar\\baz"); |
| 348 | assertEcho(result, "17-foo\\'bar'\\"baz""); |
| 349 | assertEcho(result, "18-3"); |
| 350 | assertEcho(result, "19-4"); |
| 351 | assertEcho(result, "20-4"); |
| 352 | assertEcho(result, "21-[{value=11}, {value=12}, {value=13}, {value=14}]"); |
| 353 | assertEcho(result, "22-[{value=11}, {value=12}, {value=13}, {value=14}]"); |
| 354 | } |
| 355 | |
| 356 | @Test |
| 357 | public void testScriptingExpression() throws Exception { |
no test coverage detected