|
18 | 18 | */ |
19 | 19 | package de.rwth.idsg.steve; |
20 | 20 |
|
21 | | -import org.apache.tomcat.InstanceManager; |
22 | | -import org.apache.tomcat.SimpleInstanceManager; |
23 | | -import org.eclipse.jetty.ee10.apache.jsp.JettyJasperInitializer; |
24 | | -import org.eclipse.jetty.ee10.servlet.ServletContextHandler; |
25 | 21 | import org.eclipse.jetty.ee10.webapp.WebAppContext; |
26 | 22 | import org.eclipse.jetty.rewrite.handler.RedirectPatternRule; |
27 | 23 | import org.eclipse.jetty.rewrite.handler.RewriteHandler; |
28 | 24 | import org.eclipse.jetty.server.Handler; |
29 | 25 | import org.eclipse.jetty.server.handler.ContextHandler; |
30 | 26 | import org.eclipse.jetty.server.handler.ContextHandlerCollection; |
31 | 27 | import org.eclipse.jetty.server.handler.gzip.GzipHandler; |
32 | | -import org.eclipse.jetty.util.component.AbstractLifeCycle; |
33 | 28 | import org.springframework.core.io.ClassPathResource; |
34 | 29 |
|
35 | 30 | import java.io.IOException; |
@@ -68,8 +63,6 @@ public SteveAppContext() { |
68 | 63 | // https://jetty.org/docs/jetty/12.1/programming-guide/maven-jetty/jetty-maven-plugin.html |
69 | 64 | // https://jetty.org/docs/jetty/12.1/operations-guide/annotations/index.html#og-container-include-jar-pattern |
70 | 65 | webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", SCAN_PATTERN); |
71 | | - |
72 | | - initJSP(webAppContext); |
73 | 66 | } |
74 | 67 |
|
75 | 68 | public ContextHandlerCollection getHandlers() { |
@@ -117,64 +110,11 @@ private HashSet<String> getRedirectSet() { |
117 | 110 | return redirectSet; |
118 | 111 | } |
119 | 112 |
|
120 | | - /** |
121 | | - * Help by: |
122 | | - * https://github.com/jetty/jetty-examples/tree/12.0.x/embedded/ee10-jsp |
123 | | - * https://github.com/jetty-project/embedded-jetty-jsp |
124 | | - * https://github.com/jasonish/jetty-springmvc-jsp-template |
125 | | - * http://examples.javacodegeeks.com/enterprise-java/jetty/jetty-jsp-example |
126 | | - */ |
127 | | - private void initJSP(WebAppContext ctx) { |
128 | | - ctx.addBean(new EmbeddedJspStarter(ctx)); |
129 | | - ctx.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); |
130 | | - } |
131 | | - |
132 | 113 | private static String getWebAppURIAsString() { |
133 | 114 | try { |
134 | 115 | return new ClassPathResource("webapp").getURI().toString(); |
135 | 116 | } catch (IOException e) { |
136 | 117 | throw new RuntimeException(e); |
137 | 118 | } |
138 | 119 | } |
139 | | - |
140 | | - /** |
141 | | - * From: https://github.com/jetty/jetty-examples/blob/12.0.x/embedded/ee10-jsp/src/main/java/examples/EmbeddedJspStarter.java |
142 | | - * |
143 | | - * JspStarter for embedded ServletContextHandlers |
144 | | - * |
145 | | - * This is added as a bean that is a jetty LifeCycle on the ServletContextHandler. |
146 | | - * This bean's doStart method will be called as the ServletContextHandler starts, |
147 | | - * and will call the ServletContainerInitializer for the jsp engine. |
148 | | - */ |
149 | | - public static class EmbeddedJspStarter extends AbstractLifeCycle { |
150 | | - |
151 | | - private final JettyJasperInitializer sci; |
152 | | - private final ServletContextHandler context; |
153 | | - |
154 | | - public EmbeddedJspStarter(ServletContextHandler context) { |
155 | | - this.sci = new JettyJasperInitializer(); |
156 | | - this.context = context; |
157 | | - |
158 | | - // we dont need all this from the example, since our JSPs are precompiled |
159 | | - // |
160 | | - // StandardJarScanner jarScanner = new StandardJarScanner(); |
161 | | - // StandardJarScanFilter jarScanFilter = new StandardJarScanFilter(); |
162 | | - // jarScanFilter.setTldScan("taglibs-standard-impl-*"); |
163 | | - // jarScanFilter.setTldSkip("apache-*,ecj-*,jetty-*,asm-*,javax.servlet-*,javax.annotation-*,taglibs-standard-spec-*"); |
164 | | - // jarScanner.setJarScanFilter(jarScanFilter); |
165 | | - // this.context.setAttribute("org.apache.tomcat.JarScanner", jarScanner); |
166 | | - } |
167 | | - |
168 | | - @Override |
169 | | - protected void doStart() throws Exception { |
170 | | - ClassLoader old = Thread.currentThread().getContextClassLoader(); |
171 | | - Thread.currentThread().setContextClassLoader(context.getClassLoader()); |
172 | | - try { |
173 | | - sci.onStartup(null, context.getServletContext()); |
174 | | - super.doStart(); |
175 | | - } finally { |
176 | | - Thread.currentThread().setContextClassLoader(old); |
177 | | - } |
178 | | - } |
179 | | - } |
180 | 120 | } |
0 commit comments