Commit 1552aca1 authored by Guus der Kinderen's avatar Guus der Kinderen

Merge pull request #585 from danielhams/develmodefix

Allow JSP compilation with developmentMode=true
parents f1cba6ed 63fc929c
...@@ -174,5 +174,6 @@ ...@@ -174,5 +174,6 @@
<classpathentry kind="lib" path="src/plugins/rayo/lib/validation-api-1.1.0.Final.jar"/> <classpathentry kind="lib" path="src/plugins/rayo/lib/validation-api-1.1.0.Final.jar"/>
<classpathentry kind="lib" path="src/plugins/rayo/lib/cmu_us_kal.jar"/> <classpathentry kind="lib" path="src/plugins/rayo/lib/cmu_us_kal.jar"/>
<classpathentry kind="lib" path="src/plugins/rayo/lib/en_us.jar"/> <classpathentry kind="lib" path="src/plugins/rayo/lib/en_us.jar"/>
<classpathentry kind="lib" path="build/lib/merge/jetty-annotations.jar"/>
<classpathentry kind="output" path="work/classes"/> <classpathentry kind="output" path="work/classes"/>
</classpath> </classpath>
...@@ -15,6 +15,7 @@ concurrentlinkedhashmap-lru | concurrentlinkedhashmap-lru-1.0_jdk5 ...@@ -15,6 +15,7 @@ concurrentlinkedhashmap-lru | concurrentlinkedhashmap-lru-1.0_jdk5
dbutil.jar | Jive Code, no release version. | GPL dbutil.jar | Jive Code, no release version. | GPL
hsqldb.jar | 1.8.0.5 | BSD (http://hsqldb.org/web/hsqlLicense.html) hsqldb.jar | 1.8.0.5 | BSD (http://hsqldb.org/web/hsqlLicense.html)
jcl-over-slf4j.jar | 1.7.7 | http://www.slf4j.org/license.html jcl-over-slf4j.jar | 1.7.7 | http://www.slf4j.org/license.html
jetty-annotations.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0
jetty-continuation.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0 jetty-continuation.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0
jetty-http.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0 jetty-http.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0
jetty-io.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0 jetty-io.jar | Jetty 9.2.14.v20151106 | Apache 2.0, Eclipse 1.0
......
...@@ -25,9 +25,10 @@ import java.security.cert.X509Certificate; ...@@ -25,9 +25,10 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.jasper.servlet.JasperInitializer;
import org.apache.tomcat.InstanceManager; import org.apache.tomcat.InstanceManager;
import org.apache.tomcat.SimpleInstanceManager; import org.apache.tomcat.SimpleInstanceManager;
import org.eclipse.jetty.apache.jsp.JettyJasperInitializer; import org.eclipse.jetty.annotations.ServletContainerInitializersStarter;
import org.eclipse.jetty.plus.annotation.ContainerInitializer; import org.eclipse.jetty.plus.annotation.ContainerInitializer;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Handler;
...@@ -40,7 +41,6 @@ import org.eclipse.jetty.server.SslConnectionFactory; ...@@ -40,7 +41,6 @@ import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler; import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector; import org.eclipse.jetty.spdy.server.http.HTTPSPDYServerConnector;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.QueuedThreadPool;
...@@ -328,11 +328,14 @@ public class AdminConsolePlugin implements Plugin { ...@@ -328,11 +328,14 @@ public class AdminConsolePlugin implements Plugin {
} }
private void createWebAppContext() { private void createWebAppContext() {
ServletContextHandler context; WebAppContext context;
// Add web-app. Check to see if we're in development mode. If so, we don't // Add web-app. Check to see if we're in development mode. If so, we don't
// add the normal web-app location, but the web-app in the project directory. // add the normal web-app location, but the web-app in the project directory.
if (Boolean.getBoolean("developmentMode")) { boolean developmentMode = Boolean.getBoolean("developmentMode");
if( developmentMode )
{
System.out.println(LocaleUtils.getLocalizedString("admin.console.devmode")); System.out.println(LocaleUtils.getLocalizedString("admin.console.devmode"));
context = new WebAppContext(contexts, pluginDir.getParentFile().getParentFile().getParentFile().getParent() + context = new WebAppContext(contexts, pluginDir.getParentFile().getParentFile().getParentFile().getParent() +
File.separator + "src" + File.separator + "web", "/"); File.separator + "src" + File.separator + "web", "/");
} }
...@@ -343,11 +346,19 @@ public class AdminConsolePlugin implements Plugin { ...@@ -343,11 +346,19 @@ public class AdminConsolePlugin implements Plugin {
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs). // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>(); final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JettyJasperInitializer(), null)); initializers.add(new ContainerInitializer(new JasperInitializer(), null));
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
context.setWelcomeFiles(new String[]{"index.jsp"}); // The index.html includes a redirect to the index.jsp and doesn't bypass
// the context security when in development mode
context.setWelcomeFiles(new String[]{"index.html"});
// Make sure the context initialization is done when in development mode
if( developmentMode )
{
context.addBean( new ServletContainerInitializersStarter( context ), true );
}
} }
private void log(String string) { private void log(String string) {
......
...@@ -30,9 +30,9 @@ import javax.servlet.Filter; ...@@ -30,9 +30,9 @@ import javax.servlet.Filter;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.apache.jasper.servlet.JasperInitializer;
import org.apache.tomcat.InstanceManager; import org.apache.tomcat.InstanceManager;
import org.apache.tomcat.SimpleInstanceManager; import org.apache.tomcat.SimpleInstanceManager;
import org.eclipse.jetty.apache.jsp.JettyJasperInitializer;
import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.plus.annotation.ContainerInitializer; import org.eclipse.jetty.plus.annotation.ContainerInitializer;
import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Connector;
...@@ -58,9 +58,7 @@ import org.eclipse.jetty.webapp.WebAppContext; ...@@ -58,9 +58,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
import org.jivesoftware.openfire.Connection; import org.jivesoftware.openfire.Connection;
import org.jivesoftware.openfire.JMXManager; import org.jivesoftware.openfire.JMXManager;
import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.keystore.CertificateStoreManager;
import org.jivesoftware.openfire.keystore.IdentityStore; import org.jivesoftware.openfire.keystore.IdentityStore;
import org.jivesoftware.openfire.session.ConnectionSettings;
import org.jivesoftware.openfire.spi.ConnectionConfiguration; import org.jivesoftware.openfire.spi.ConnectionConfiguration;
import org.jivesoftware.openfire.spi.ConnectionManagerImpl; import org.jivesoftware.openfire.spi.ConnectionManagerImpl;
import org.jivesoftware.openfire.spi.ConnectionType; import org.jivesoftware.openfire.spi.ConnectionType;
...@@ -541,7 +539,7 @@ public final class HttpBindManager { ...@@ -541,7 +539,7 @@ public final class HttpBindManager {
ServletContextHandler context = new ServletContextHandler(contexts, boshPath, ServletContextHandler.SESSIONS); ServletContextHandler context = new ServletContextHandler(contexts, boshPath, ServletContextHandler.SESSIONS);
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs). // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>(); final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JettyJasperInitializer(), null)); initializers.add(new ContainerInitializer(new JasperInitializer(), null));
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
context.addServlet(new ServletHolder(new HttpBindServlet()),"/*"); context.addServlet(new ServletHolder(new HttpBindServlet()),"/*");
...@@ -572,7 +570,7 @@ public final class HttpBindManager { ...@@ -572,7 +570,7 @@ public final class HttpBindManager {
ServletContextHandler context = new ServletContextHandler(contexts, crossPath, ServletContextHandler.SESSIONS); ServletContextHandler context = new ServletContextHandler(contexts, crossPath, ServletContextHandler.SESSIONS);
// Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs). // Ensure the JSP engine is initialized correctly (in order to be able to cope with Tomcat/Jasper precompiled JSPs).
final List<ContainerInitializer> initializers = new ArrayList<>(); final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JettyJasperInitializer(), null)); initializers.add(new ContainerInitializer(new JasperInitializer(), null));
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
context.addServlet(new ServletHolder(new FlashCrossDomainServlet()),""); context.addServlet(new ServletHolder(new FlashCrossDomainServlet()),"");
......
...@@ -33,7 +33,8 @@ import java.util.*; ...@@ -33,7 +33,8 @@ import java.util.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.eclipse.jetty.apache.jsp.JettyJasperInitializer; import org.apache.jasper.servlet.JasperInitializer;
import org.eclipse.jetty.plus.annotation.ContainerInitializer; import org.eclipse.jetty.plus.annotation.ContainerInitializer;
import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
...@@ -122,7 +123,7 @@ public class JmxWebPlugin implements Plugin { ...@@ -122,7 +123,7 @@ public class JmxWebPlugin implements Plugin {
WebAppContext context = new WebAppContext(contexts, pluginDirectory.getPath(), "/jolokia"); WebAppContext context = new WebAppContext(contexts, pluginDirectory.getPath(), "/jolokia");
final List<ContainerInitializer> initializers = new ArrayList<>(); final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JettyJasperInitializer(), null)); initializers.add(new ContainerInitializer(new JasperInitializer(), null));
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); context.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
context.setWelcomeFiles(new String[]{"index.html"}); context.setWelcomeFiles(new String[]{"index.html"});
...@@ -130,7 +131,7 @@ public class JmxWebPlugin implements Plugin { ...@@ -130,7 +131,7 @@ public class JmxWebPlugin implements Plugin {
Log.info( "["+ NAME + "] starting hawtio"); Log.info( "["+ NAME + "] starting hawtio");
WebAppContext context2 = new WebAppContext(contexts, pluginDirectory.getPath() + "/hawtio", "/hawtio"); WebAppContext context2 = new WebAppContext(contexts, pluginDirectory.getPath() + "/hawtio", "/hawtio");
final List<ContainerInitializer> initializers2 = new ArrayList<>(); final List<ContainerInitializer> initializers2 = new ArrayList<>();
initializers2.add(new ContainerInitializer(new JettyJasperInitializer(), null)); initializers2.add(new ContainerInitializer(new JasperInitializer(), null));
context2.setAttribute("org.eclipse.jetty.containerInitializers", initializers2); context2.setAttribute("org.eclipse.jetty.containerInitializers", initializers2);
context2.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager()); context2.setAttribute(InstanceManager.class.getName(), new SimpleInstanceManager());
context2.setWelcomeFiles(new String[]{"index.html"}); context2.setWelcomeFiles(new String[]{"index.html"});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment