Skip to content

Commit d8793a9

Browse files
committed
remove JSP initializer impl for Jetty
reason: apparently, it is not needed (anymore?). the web pages work just fine without it.
1 parent 27a13e1 commit d8793a9

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

src/main/java/de/rwth/idsg/steve/SteveAppContext.java

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@
1818
*/
1919
package de.rwth.idsg.steve;
2020

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;
2521
import org.eclipse.jetty.ee10.webapp.WebAppContext;
2622
import org.eclipse.jetty.rewrite.handler.RedirectPatternRule;
2723
import org.eclipse.jetty.rewrite.handler.RewriteHandler;
2824
import org.eclipse.jetty.server.Handler;
2925
import org.eclipse.jetty.server.handler.ContextHandler;
3026
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
3127
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
32-
import org.eclipse.jetty.util.component.AbstractLifeCycle;
3328
import org.springframework.core.io.ClassPathResource;
3429

3530
import java.io.IOException;
@@ -68,8 +63,6 @@ public SteveAppContext() {
6863
// https://jetty.org/docs/jetty/12.1/programming-guide/maven-jetty/jetty-maven-plugin.html
6964
// https://jetty.org/docs/jetty/12.1/operations-guide/annotations/index.html#og-container-include-jar-pattern
7065
webAppContext.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", SCAN_PATTERN);
71-
72-
initJSP(webAppContext);
7366
}
7467

7568
public ContextHandlerCollection getHandlers() {
@@ -117,64 +110,11 @@ private HashSet<String> getRedirectSet() {
117110
return redirectSet;
118111
}
119112

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-
132113
private static String getWebAppURIAsString() {
133114
try {
134115
return new ClassPathResource("webapp").getURI().toString();
135116
} catch (IOException e) {
136117
throw new RuntimeException(e);
137118
}
138119
}
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-
}
180120
}

0 commit comments

Comments
 (0)