This is an automated email from the ASF dual-hosted git repository.
bhaisaab pushed a commit to branch CLOUDSTACK-10012
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/CLOUDSTACK-10012 by this push:
new 42d9297 CLOUDSTACK-10012: ServerDaemon customization (#2272)
42d9297 is described below
commit 42d9297178e6d8cd3fbfc1785b8905cc7e99534b
Author: Marc-Aurèle Brothier <[email protected]>
AuthorDate: Mon Sep 25 07:46:33 2017 +0200
CLOUDSTACK-10012: ServerDaemon customization (#2272)
- add option to allow loading another webapp (cloudstack-ui for example)
- remove `jetty` in param keywords as it's better to stay agnostic
---
client/src/org/apache/cloudstack/ServerDaemon.java | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/client/src/org/apache/cloudstack/ServerDaemon.java
b/client/src/org/apache/cloudstack/ServerDaemon.java
index a1ddbd3..fb213e3 100644
--- a/client/src/org/apache/cloudstack/ServerDaemon.java
+++ b/client/src/org/apache/cloudstack/ServerDaemon.java
@@ -53,13 +53,13 @@ import java.util.Properties;
public class ServerDaemon implements Daemon {
private static final Logger logger =
LoggerFactory.getLogger(ServerDaemon.class);
private static final String WEB_XML = "META-INF/webapp/WEB-INF/web.xml";
- private static final String PROJECT_RELATIVE_PATH_TO_WEBAPP =
"src/main/webapp";
private static final String REQUEST_LOG = "request.log";
private Server jettyServer;
private int port;
private String bindInterface;
private String requestLogFile;
+ private String webAppLocation;
public static void main(String... anArgs) throws Exception {
ServerDaemon csServer = new ServerDaemon();
@@ -71,9 +71,10 @@ public class ServerDaemon implements Daemon {
@Override
public void init(DaemonContext context) {
Properties props = System.getProperties();
- setPort(Integer.parseInt(props.getProperty("jetty.port", "8080")));
- setBindInterface(props.getProperty("jetty.host"));
- setRequestLogFile(props.getProperty("jetty.requestlog", REQUEST_LOG));
+ setPort(Integer.parseInt(props.getProperty("port", "8080")));
+ setBindInterface(props.getProperty("host"));
+ setWebAppLocation(props.getProperty("webapp"));
+ setRequestLogFile(props.getProperty("requestlog", REQUEST_LOG));
StringBuilder sb = new StringBuilder("Initializing server daemon on ");
sb.append(bindInterface == null ? "*" : bindInterface);
sb.append(":");
@@ -135,6 +136,10 @@ public class ServerDaemon implements Daemon {
this.requestLogFile = requestLogFile;
}
+ public void setWebAppLocation(String webAppLocation) {
+ this.webAppLocation = webAppLocation;
+ }
+
private ThreadPool createThreadPool() {
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMinThreads(10);
@@ -153,10 +158,10 @@ public class ServerDaemon implements Daemon {
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/client");
- if (isRunningInShadedJar()) {
+ if (webAppLocation == null) {
webapp.setWar(getShadedWarUrl());
} else {
- webapp.setWar(PROJECT_RELATIVE_PATH_TO_WEBAPP);
+ webapp.setWar(webAppLocation);
}
List<Handler> handlers = new ArrayList<>();
@@ -189,11 +194,6 @@ public class ServerDaemon implements Daemon {
return log;
}
-
- private boolean isRunningInShadedJar() {
- return true;
- }
-
private URL getResource(String aResource) {
return
Thread.currentThread().getContextClassLoader().getResource(aResource);
}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].