cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10012) Migrate to Embedded Jetty based mgmt server
Date Fri, 17 Nov 2017 17:57:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257316#comment-16257316
] 

ASF GitHub Bot commented on CLOUDSTACK-10012:
---------------------------------------------

rhtyd closed pull request #2329: CLOUDSTACK-10012: Jetty 9.4
URL: https://github.com/apache/cloudstack/pull/2329
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/client/conf/server.properties.in b/client/conf/server.properties.in
index 7140bd26e26..f255128555c 100644
--- a/client/conf/server.properties.in
+++ b/client/conf/server.properties.in
@@ -24,6 +24,9 @@ context.path=/client
 # The HTTP port to be used by the management server
 http.port=8080
 
+# Max inactivity time in minutes for the session
+session.timeout=30
+
 # Options to configure and enable HTTPS on management server
 #
 # For management server to pickup these configuration settings, the configured
diff --git a/client/pom.xml b/client/pom.xml
index 1545bfa11f2..63980b9a1f2 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -491,7 +491,7 @@
       <plugin>
         <groupId>org.eclipse.jetty</groupId>
         <artifactId>jetty-maven-plugin</artifactId>
-        <version>${cs.jetty.version}</version>
+        <version>${cs.jetty-maven-plugin.version}</version>
         <dependencies>
           <!-- specify the dependent jdbc driver here -->
           <dependency>
diff --git a/client/src/org/apache/cloudstack/ServerDaemon.java b/client/src/org/apache/cloudstack/ServerDaemon.java
index 65e9a907cfd..985b67b755a 100644
--- a/client/src/org/apache/cloudstack/ServerDaemon.java
+++ b/client/src/org/apache/cloudstack/ServerDaemon.java
@@ -22,13 +22,8 @@
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.net.URL;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.Properties;
 
-import javax.servlet.DispatcherType;
-
 import org.apache.commons.daemon.Daemon;
 import org.apache.commons.daemon.DaemonContext;
 import org.eclipse.jetty.jmx.MBeanContainer;
@@ -42,9 +37,9 @@
 import org.eclipse.jetty.server.ServerConnector;
 import org.eclipse.jetty.server.SslConnectionFactory;
 import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.handler.MovedContextHandler;
 import org.eclipse.jetty.server.handler.RequestLogHandler;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlets.GzipFilter;
+import org.eclipse.jetty.server.handler.gzip.GzipHandler;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
@@ -70,6 +65,7 @@
 
     private static final String BIND_INTERFACE = "bind.interface";
     private static final String CONTEXT_PATH = "context.path";
+    private static final String SESSION_TIMEOUT = "session.timeout";
     private static final String HTTP_PORT = "http.port";
     private static final String HTTPS_ENABLE = "https.enable";
     private static final String HTTPS_PORT = "https.port";
@@ -86,6 +82,7 @@
 
     private int httpPort = 8080;
     private int httpsPort = 8443;
+    private int sessionTimeout = 30;
     private boolean httpsEnable = false;
     private String accessLogFile = "access.log";
     private String bindInterface = "";
@@ -129,6 +126,7 @@ public void init(final DaemonContext context) {
             setKeystorePassword(properties.getProperty(KEYSTORE_PASSWORD));
             setWebAppLocation(properties.getProperty(WEBAPP_DIR));
             setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log"));
+            setSessionTimeout(Integer.valueOf(properties.getProperty(SESSION_TIMEOUT, "30")));
         } catch (final IOException e) {
             LOG.warn("Failed to load configuration from server.properties file", e);
         }
@@ -221,13 +219,14 @@ private HandlerCollection createHandlers() {
         final WebAppContext webApp = new WebAppContext();
         webApp.setContextPath(contextPath);
         webApp.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
+        webApp.getSessionHandler().setMaxInactiveInterval(sessionTimeout * 60);
 
-        final FilterHolder filter = webApp.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
-        final Map<String, String> params = new HashMap<>();
-        params.put("mimeTypes", "text/html,text/xml,text/css,text/plain,text/javascript,application/javascript,application/json,application/xml");
-        params.put("methods", "GET,POST");
-        params.put("deflateCompressionLevel", "9");
-        filter.setInitParameters(params);
+        // GZIP handler
+        final GzipHandler gzipHandler = new GzipHandler();
+        gzipHandler.addIncludedMimeTypes("text/html", "text/xml", "text/css", "text/plain",
"text/javascript", "application/javascript", "application/json", "application/xml");
+        gzipHandler.setIncludedMethods("GET", "POST");
+        gzipHandler.setCompressionLevel(9);
+        gzipHandler.setHandler(webApp);
 
         if (Strings.isNullOrEmpty(webAppLocation)) {
             webApp.setWar(getShadedWarUrl());
@@ -235,14 +234,18 @@ private HandlerCollection createHandlers() {
             webApp.setWar(webAppLocation);
         }
 
+        // Request log handler
         final RequestLogHandler log = new RequestLogHandler();
         log.setRequestLog(createRequestLog());
 
-        final HandlerCollection handlerCollection = new HandlerCollection();
-        handlerCollection.addHandler(log);
-        handlerCollection.addHandler(webApp);
+        // Redirect root context handler
+        MovedContextHandler rootRedirect = new MovedContextHandler();
+        rootRedirect.setContextPath("/");
+        rootRedirect.setNewContextURL(contextPath);
+        rootRedirect.setPermanent(true);
 
-        return handlerCollection;
+        // Put rootRedirect at the end!
+        return new HandlerCollection(log, gzipHandler, rootRedirect);
     }
 
     private RequestLog createRequestLog() {
@@ -307,4 +310,8 @@ public void setAccessLogFile(String accessLogFile) {
     public void setWebAppLocation(String webAppLocation) {
         this.webAppLocation = webAppLocation;
     }
+
+    public void setSessionTimeout(int sessionTimeout) {
+        this.sessionTimeout = sessionTimeout;
+    }
 }
diff --git a/plugins/integrations/cloudian/pom.xml b/plugins/integrations/cloudian/pom.xml
index 3e2b63562fb..3138bb668ff 100644
--- a/plugins/integrations/cloudian/pom.xml
+++ b/plugins/integrations/cloudian/pom.xml
@@ -52,7 +52,7 @@
     </dependency>
     <dependency>
       <groupId>com.github.tomakehurst</groupId>
-      <artifactId>wiremock</artifactId>
+      <artifactId>wiremock-standalone</artifactId>
       <version>${cs.wiremock.version}</version>
       <scope>test</scope>
     </dependency>
diff --git a/pom.xml b/pom.xml
index 4ec4d111a6f..b496a1611aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,8 +122,9 @@
     <cs.cxf.version>3.2.0</cs.cxf.version>
     <cs.groovy.version>2.4.12</cs.groovy.version>
     <cs.nitro.version>10.1</cs.nitro.version>
-    <cs.wiremock.version>2.8.0</cs.wiremock.version>
-    <cs.jetty.version>9.2.22.v20170606</cs.jetty.version>
+    <cs.wiremock.version>2.11.0</cs.wiremock.version>
+    <cs.jetty.version>9.4.7.v20170914</cs.jetty.version>
+    <cs.jetty-maven-plugin.version>9.2.22.v20170606</cs.jetty-maven-plugin.version>
   </properties>
 
   <distributionManagement>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Migrate to Embedded Jetty based mgmt server
> -------------------------------------------
>
>                 Key: CLOUDSTACK-10012
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10012
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Rohit Yadav
>            Assignee: Rohit Yadav
>             Fix For: Future, 4.11.0.0
>
>
> CloudStack installation has huge dependency on distro provided tomcat, by moving to embedded
jetty (like we do use jetty for development) we can sync how developers develop/test mgmt
servers and users use it. In addition, it will be easier to publish pkgs without depending
on distro provided dependencies.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message