Skip to content

Commit

Permalink
fixed binding retardedness
Browse files Browse the repository at this point in the history
  • Loading branch information
dries007 committed Oct 19, 2014
1 parent a1c62f7 commit 132a7e8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/net/doubledoordev/backend/Main.java
Expand Up @@ -105,10 +105,12 @@ public static void main(String[] args) throws Exception
if (SETTINGS.portHTTP != 0)
{
LOGGER.info("HTTP Redirect server started on " + SETTINGS.hostname + ':' + SETTINGS.portHTTP);
new RedirectToSSLServer(SETTINGS.hostname, SETTINGS.portHTTP).start();
if (Strings.isNotBlank(SETTINGS.hostname)) new RedirectToSSLServer(SETTINGS.hostname, SETTINGS.portHTTP).start();
else new RedirectToSSLServer(SETTINGS.portHTTP).start();
}
LOGGER.info("HTTPS Webserver started on " + SETTINGS.hostname + ':' + SETTINGS.portHTTPS);
Webserver.WEBSERVER = new Webserver(SETTINGS.hostname, SETTINGS.portHTTPS);
if (Strings.isNotBlank(SETTINGS.hostname)) Webserver.WEBSERVER = new Webserver(SETTINGS.hostname, SETTINGS.portHTTPS);
else Webserver.WEBSERVER = new Webserver(SETTINGS.portHTTPS);
Webserver.WEBSERVER.makeSecure(NanoHTTPD.makeSSLSocketFactory(SETTINGS.certificatePath, SETTINGS.certificatePass));
}
Webserver.WEBSERVER.start();
Expand Down
Expand Up @@ -102,6 +102,15 @@ public SimpleWebServer(String host, int port, String wwwroot)
this.init();
}

public SimpleWebServer(int port, String wwwroot)
{
super(port);
if (!wwwroot.endsWith("/")) wwwroot += "/";
this.rootDir = wwwroot;

this.init();
}

/**
* Used to initialize and customize the server.
*/
Expand Down
Expand Up @@ -71,6 +71,11 @@ public Webserver(String hostname, int port)
super(hostname, port, STATIC_PATH);
}

public Webserver(int port)
{
super(port, STATIC_PATH);
}

/**
* The entry point for all HTTP requests
*
Expand Down

0 comments on commit 132a7e8

Please sign in to comment.