Skip to content

Commit a764cad

Browse files
committed
novnc console added
1 parent be8ae98 commit a764cad

43 files changed

Lines changed: 12801 additions & 552 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

server/src/com/cloud/servlet/ConsoleProxyServlet.java

Lines changed: 166 additions & 164 deletions
Large diffs are not rendered by default.

services/console-proxy/server/pom.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@
4949
<artifactId>cloudstack-service-console-proxy-rdpclient</artifactId>
5050
<version>${project.version}</version>
5151
</dependency>
52+
<dependency>
53+
<groupId>org.eclipse.jetty</groupId>
54+
<artifactId>jetty-server</artifactId>
55+
<version>9.2.20.v20161216</version>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.eclipse.jetty.websocket</groupId>
59+
<artifactId>websocket-server</artifactId>
60+
<version>9.2.20.v20161216</version>
61+
</dependency>
5262
</dependencies>
5363
<build>
5464
<resources>
@@ -60,4 +70,4 @@
6070
</resource>
6171
</resources>
6272
</build>
63-
</project>
73+
</project>

services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxy.java

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import com.cloud.consoleproxy.util.Logger;
4343
import com.cloud.utils.PropertiesUtil;
44+
import org.eclipse.jetty.server.Server;
4445

4546
/**
4647
*
@@ -328,7 +329,7 @@ public static void start(Properties conf) {
328329
}
329330

330331
if (httpListenPort != 0) {
331-
startupHttpMain();
332+
startServerForNoVNC();
332333
} else {
333334
s_logger.error("A valid HTTP server port is required to be specified, please check your consoleproxy.httpListenPort settings");
334335
System.exit(1);
@@ -345,27 +346,6 @@ public static void start(Properties conf) {
345346
cthread.start();
346347
}
347348

348-
private static void startupHttpMain() {
349-
try {
350-
ConsoleProxyServerFactory factory = getHttpServerFactory();
351-
if (factory == null) {
352-
s_logger.error("Unable to load HTTP server factory");
353-
System.exit(1);
354-
}
355-
356-
HttpServer server = factory.createHttpServerInstance(httpListenPort);
357-
server.createContext("/getscreen", new ConsoleProxyThumbnailHandler());
358-
server.createContext("/resource/", new ConsoleProxyResourceHandler());
359-
server.createContext("/ajax", new ConsoleProxyAjaxHandler());
360-
server.createContext("/ajaximg", new ConsoleProxyAjaxImageHandler());
361-
server.setExecutor(new ThreadExecutor()); // creates a default executor
362-
server.start();
363-
} catch (Exception e) {
364-
s_logger.error(e.getMessage(), e);
365-
System.exit(1);
366-
}
367-
}
368-
369349
private static void startupHttpCmdPort() {
370350
try {
371351
s_logger.info("Listening for HTTP CMDs on port " + httpCmdListenPort);
@@ -379,7 +359,23 @@ private static void startupHttpCmdPort() {
379359
}
380360
}
381361

382-
public static void main(String[] argv) {
362+
private static void startServerForNoVNC() {
363+
try {
364+
ConsoleProxyServerFactory factory = getHttpServerFactory();
365+
if (factory == null) {
366+
s_logger.error("Unable to load HTTP server factory");
367+
System.exit(1);
368+
}
369+
Server webServer = factory.
370+
createConsoleProxyServer(443);
371+
webServer.start();
372+
} catch (Exception e) {
373+
s_logger.error(" could not start webserver at 80", e);
374+
throw new RuntimeException("could not start webserver at 80");
375+
}
376+
}
377+
378+
public static void main(String[] argv) throws Exception {
383379
standaloneStart = true;
384380
configLog4j();
385381
Logger.setFactory(new ConsoleProxyLoggerFactory());

0 commit comments

Comments
 (0)