|
19 | 19 |
|
20 | 20 | import java.io.File; |
21 | 21 | import java.io.IOException; |
| 22 | +import java.util.Collections; |
22 | 23 | import java.util.concurrent.CountDownLatch; |
23 | 24 | import java.util.concurrent.TimeUnit; |
24 | 25 | import javax.servlet.jsp.JspFactory; |
25 | 26 | import org.apache.jasper.runtime.JspFactoryImpl; |
26 | 27 | import org.apache.tomcat.InstanceManager; |
27 | 28 | import org.apache.tomcat.SimpleInstanceManager; |
28 | | - |
| 29 | +import org.eclipse.jetty.apache.jsp.JettyJasperInitializer; |
29 | 30 | import org.eclipse.jetty.io.MappedByteBufferPool; |
30 | 31 | import org.eclipse.jetty.server.Handler; |
31 | 32 | import org.eclipse.jetty.server.HttpConfiguration; |
|
37 | 38 | import org.eclipse.jetty.server.handler.DefaultHandler; |
38 | 39 | import org.eclipse.jetty.server.handler.HandlerCollection; |
39 | 40 | import org.eclipse.jetty.server.handler.RequestLogHandler; |
| 41 | +import org.eclipse.jetty.util.component.AbstractLifeCycle; |
40 | 42 | import org.eclipse.jetty.util.log.Log; |
41 | 43 | import org.eclipse.jetty.util.thread.QueuedThreadPool; |
42 | 44 |
|
@@ -135,14 +137,26 @@ public void run() { |
135 | 137 | new File("target/log.0.1.lck").delete(); |
136 | 138 |
|
137 | 139 | // configuration from root.xml |
138 | | - VmRuntimeWebAppContext context = new VmRuntimeWebAppContext(); |
| 140 | + final VmRuntimeWebAppContext context = new VmRuntimeWebAppContext(); |
139 | 141 | context.setContextPath("/"); |
140 | 142 | context.setConfigurationClasses(preconfigurationClasses); |
141 | 143 |
|
142 | | - // Needed for JSP! |
143 | | - context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); |
144 | | - JspFactory.setDefaultFactory(new JspFactoryImpl()); |
145 | | - |
| 144 | + |
| 145 | + // Needed to initialize JSP! |
| 146 | + context.addBean(new AbstractLifeCycle() { |
| 147 | + |
| 148 | + @Override |
| 149 | + public void doStop() throws Exception { |
| 150 | + |
| 151 | + } |
| 152 | + |
| 153 | + @Override |
| 154 | + public void doStart() throws Exception { |
| 155 | + JettyJasperInitializer jspInit = new JettyJasperInitializer(); |
| 156 | + jspInit.onStartup(Collections.EMPTY_SET, context.getServletContext()); |
| 157 | + } |
| 158 | + }, true); |
| 159 | + |
146 | 160 | // find the sibling testwebapp target |
147 | 161 | File currentDir = new File("").getAbsoluteFile(); |
148 | 162 | File webAppLocation = new File(currentDir, "target/webapps/testwebapp"); |
|
0 commit comments