knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmin...@apache.org
Subject knox git commit: [KNOX-692] - Enable Jetty's JSP support in Knox hosted applications.
Date Sun, 13 Mar 2016 18:00:52 GMT
Repository: knox
Updated Branches:
  refs/heads/master 2074cddf0 -> 687dd1da9


[KNOX-692] - Enable Jetty's JSP support in Knox hosted applications.


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/687dd1da
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/687dd1da
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/687dd1da

Branch: refs/heads/master
Commit: 687dd1da951be2f4efa50d2d4704f0ad38ce7bd9
Parents: 2074cdd
Author: Kevin Minder <kminder@apache.org>
Authored: Sun Mar 13 13:48:07 2016 -0400
Committer: Kevin Minder <kminder@apache.org>
Committed: Sun Mar 13 13:48:07 2016 -0400

----------------------------------------------------------------------
 CHANGES                                             |  3 ++-
 gateway-server/pom.xml                              | 16 ++++++++++++++++
 .../org/apache/hadoop/gateway/GatewayServer.java    | 11 +++++++++++
 pom.xml                                             | 16 ++++++++++++++++
 4 files changed, 45 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/687dd1da/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index a757eaa..4e39f65 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,8 +2,9 @@
 Release Notes - Apache Knox - Version 0.9.0
 ------------------------------------------------------------------------------
 ** New Feature
-    * [KNOX-670] - Knox should be able to sost simple web apps
+    * [KNOX-670] - Knox should be able to host simple web apps
     * [KNOX-674] - Expose Jetty's SSL cipher suite configuration via gateway-site.xml
+    * [KNOX-692] - Enable Jetty's JSP support in Knox hosted applications.
 ** Improvement
     * [KNOX-677] - Upgrade to latest Groovy
     * [KNOX-675] - Upgrade Knox's Jetty dependency to latest 9.x

http://git-wip-us.apache.org/repos/asf/knox/blob/687dd1da/gateway-server/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-server/pom.xml b/gateway-server/pom.xml
index 20f22ae..d33fc62 100644
--- a/gateway-server/pom.xml
+++ b/gateway-server/pom.xml
@@ -192,6 +192,22 @@
             <artifactId>joda-time</artifactId>
         </dependency>
 
+        <!--
+        These dependencies (jetty-annotations, apache-jsp, apache-jstl) are required for
JSP support.
+        The need to be late in the classpath for some reason otherwise class loading issues
occur.
+        -->
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jsp</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jstl</artifactId>
+        </dependency>
 
         <!-- ********** ********** ********** ********** ********** ********** -->
         <!-- ********** Test Dependencies                           ********** -->

http://git-wip-us.apache.org/repos/asf/knox/blob/687dd1da/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
index 12ab201..947c53f 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
@@ -89,6 +89,7 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.server.handler.RequestLogHandler;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.eclipse.jetty.webapp.Configuration;
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
 import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
@@ -365,6 +366,12 @@ public class GatewayServer {
     jetty.addConnector( createConnector( jetty, config ) );
     jetty.setHandler( createHandlers( config, services, contexts ) );
 
+    // Add Annotations processing into the Jetty server to support JSPs
+    Configuration.ClassList classlist = Configuration.ClassList.setServerDefault( jetty );
+    classlist.addBefore(
+        "org.eclipse.jetty.webapp.JettyWebXmlConfiguration",
+        "org.eclipse.jetty.annotations.AnnotationConfiguration" );
+
     // Load the current topologies.
     File topologiesDir = calculateAbsoluteTopologiesDir();
     log.loadingTopologiesFromDirectory(topologiesDir.getAbsolutePath());
@@ -431,6 +438,10 @@ public class GatewayServer {
     context.setAttribute( GatewayServices.GATEWAY_CLUSTER_ATTRIBUTE, topoName );
     context.setAttribute( "org.apache.knox.gateway.frontend.uri", getFrontendUri( context,
config ) );
     context.setAttribute( GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE, config );
+    // Add support for JSPs.
+    context.setAttribute(
+        "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
+        ".*/[^/]*servlet-api-[^/]*\\.jar$|.*/javax.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$"
);
     context.setTempDirectory( FileUtils.getFile( warFile, "META-INF", "temp" ) );
     context.setErrorHandler( createErrorHandler() );
     return context;

http://git-wip-us.apache.org/repos/asf/knox/blob/687dd1da/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index aafd23b..1bd3f40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1080,6 +1080,22 @@
                 <version>1.3.2</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>jetty-annotations</artifactId>
+                <version>${jetty-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>apache-jsp</artifactId>
+                <version>${jetty-version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.eclipse.jetty</groupId>
+                <artifactId>apache-jstl</artifactId>
+                <version>${jetty-version}</version>
+            </dependency>
+
             <!-- ********** ********** ********** ********** ********** ********** -->
             <!-- ********** Test Dependencies                           ********** -->
             <!-- ********** ********** ********** ********** ********** ********** -->


Mime
View raw message