Java Code Examples for org.apache.catalina.startup.Tomcat#initWebappDefaults()
The following examples show how to use
org.apache.catalina.startup.Tomcat#initWebappDefaults() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDefaultInstanceManager.java From Tomcat8-Source-Read with MIT License | 6 votes |
private DefaultInstanceManager doClassUnloadingPrep() throws Exception { Tomcat tomcat = getTomcatInstance(); // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp"); StandardContext ctxt = (StandardContext) tomcat.addContext( null, "/test", appDir.getAbsolutePath()); ctxt.addServletContainerInitializer(new JasperInitializer(), null); // Configure the defaults and then tweak the JSP servlet settings // Note: Min value for maxLoadedJsps is 2 Tomcat.initWebappDefaults(ctxt); Wrapper w = (Wrapper) ctxt.findChild("jsp"); w.addInitParameter("maxLoadedJsps", "2"); tomcat.start(); return (DefaultInstanceManager) ctxt.getInstanceManager(); }
Example 2
Source File: TestDefaultInstanceManager.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
private DefaultInstanceManager doClassUnloadingPrep() throws Exception { Tomcat tomcat = getTomcatInstance(); // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp-3.0"); StandardContext ctxt = (StandardContext) tomcat.addContext( null, "/test", appDir.getAbsolutePath()); // Configure the defaults and then tweak the JSP servlet settings // Note: Min value for maxLoadedJsps is 2 Tomcat.initWebappDefaults(ctxt); Wrapper w = (Wrapper) ctxt.findChild("jsp"); w.addInitParameter("maxLoadedJsps", "2"); tomcat.start(); return (DefaultInstanceManager) ctxt.getInstanceManager(); }
Example 3
Source File: TestDefaultInstanceManager.java From tomcatsrc with Apache License 2.0 | 6 votes |
private DefaultInstanceManager doClassUnloadingPrep() throws Exception { Tomcat tomcat = getTomcatInstance(); // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp-3.0"); StandardContext ctxt = (StandardContext) tomcat.addContext( null, "/test", appDir.getAbsolutePath()); // Configure the defaults and then tweak the JSP servlet settings // Note: Min value for maxLoadedJsps is 2 Tomcat.initWebappDefaults(ctxt); Wrapper w = (Wrapper) ctxt.findChild("jsp"); w.addInitParameter("maxLoadedJsps", "2"); tomcat.start(); return (DefaultInstanceManager) ctxt.getInstanceManager(); }
Example 4
Source File: TestELInJsp.java From Tomcat8-Source-Read with MIT License | 4 votes |
private void doTestELMisc(boolean quoteAttributeEL) throws Exception { Tomcat tomcat = getTomcatInstance(); // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp"); StandardContext ctxt = (StandardContext) tomcat.addContext( null, "/test", appDir.getAbsolutePath()); ctxt.addServletContainerInitializer(new JasperInitializer(), null); // Configure the defaults and then tweak the JSP servlet settings // Note: Min value for maxLoadedJsps is 2 Tomcat.initWebappDefaults(ctxt); Wrapper w = (Wrapper) ctxt.findChild("jsp"); String jspName; if (quoteAttributeEL) { jspName = "/test/el-misc-with-quote-attribute-el.jsp"; w.addInitParameter("quoteAttributeEL", "true"); } else { jspName = "/test/el-misc-no-quote-attribute-el.jsp"; w.addInitParameter("quoteAttributeEL", "false"); } tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + jspName); 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, "2az-04"); assertEcho(result, "05-a2z"); assertEcho(result, "06-az2"); assertEcho(result, "2az-07"); assertEcho(result, "08-a2z"); assertEcho(result, "09-az2"); assertEcho(result, "10-${'foo'}bar"); assertEcho(result, "11-\\\"}"); assertEcho(result, "12-foo\\bar\\baz"); assertEcho(result, "13-foo\\bar\\baz"); assertEcho(result, "14-foo\\bar\\baz"); assertEcho(result, "15-foo\\bar\\baz"); assertEcho(result, "16-foo\\bar\\baz"); assertEcho(result, "17-foo\\'bar'\\"baz""); assertEcho(result, "18-3"); assertEcho(result, "19-4"); assertEcho(result, "20-4"); assertEcho(result, "21-[{value=11}, {value=12}, {value=13}, {value=14}]"); assertEcho(result, "22-[{value=11}, {value=12}, {value=13}, {value=14}]"); }
Example 5
Source File: TestELInJsp.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
private void doTestELMisc(boolean quoteAttributeEL) throws Exception { Tomcat tomcat = getTomcatInstance(); // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp-3.0"); StandardContext ctxt = (StandardContext) tomcat.addContext( null, "/test", appDir.getAbsolutePath()); // Configure the defaults and then tweak the JSP servlet settings // Note: Min value for maxLoadedJsps is 2 Tomcat.initWebappDefaults(ctxt); Wrapper w = (Wrapper) ctxt.findChild("jsp"); String jspName; if (quoteAttributeEL) { jspName = "/test/el-misc-with-quote-attribute-el.jsp"; w.addInitParameter("quoteAttributeEL", "true"); } else { jspName = "/test/el-misc-no-quote-attribute-el.jsp"; w.addInitParameter("quoteAttributeEL", "false"); } tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + jspName); 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, "2az-04"); assertEcho(result, "05-a2z"); assertEcho(result, "06-az2"); assertEcho(result, "2az-07"); assertEcho(result, "08-a2z"); assertEcho(result, "09-az2"); assertEcho(result, "10-${'foo'}bar"); assertEcho(result, "11-\\\"}"); assertEcho(result, "12-foo\\bar\\baz"); assertEcho(result, "13-foo\\bar\\baz"); assertEcho(result, "14-foo\\bar\\baz"); assertEcho(result, "15-foo\\bar\\baz"); assertEcho(result, "16-foo\\bar\\baz"); assertEcho(result, "17-foo\\'bar'\\"baz""); }
Example 6
Source File: TestELInJsp.java From tomcatsrc with Apache License 2.0 | 4 votes |
private void doTestELMisc(boolean quoteAttributeEL) throws Exception { Tomcat tomcat = getTomcatInstance(); // Create the context (don't use addWebapp as we want to modify the // JSP Servlet settings). File appDir = new File("test/webapp-3.0"); StandardContext ctxt = (StandardContext) tomcat.addContext( null, "/test", appDir.getAbsolutePath()); // Configure the defaults and then tweak the JSP servlet settings // Note: Min value for maxLoadedJsps is 2 Tomcat.initWebappDefaults(ctxt); Wrapper w = (Wrapper) ctxt.findChild("jsp"); String jspName; if (quoteAttributeEL) { jspName = "/test/el-misc-with-quote-attribute-el.jsp"; w.addInitParameter("quoteAttributeEL", "true"); } else { jspName = "/test/el-misc-no-quote-attribute-el.jsp"; w.addInitParameter("quoteAttributeEL", "false"); } tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + jspName); 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, "2az-04"); assertEcho(result, "05-a2z"); assertEcho(result, "06-az2"); assertEcho(result, "2az-07"); assertEcho(result, "08-a2z"); assertEcho(result, "09-az2"); assertEcho(result, "10-${'foo'}bar"); assertEcho(result, "11-\\\"}"); assertEcho(result, "12-foo\\bar\\baz"); assertEcho(result, "13-foo\\bar\\baz"); assertEcho(result, "14-foo\\bar\\baz"); assertEcho(result, "15-foo\\bar\\baz"); assertEcho(result, "16-foo\\bar\\baz"); assertEcho(result, "17-foo\\'bar'\\"baz""); }