4141
4242import com .cloud .consoleproxy .util .Logger ;
4343import 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