diff --git a/build.xml b/build.xml index d39324e..de766bd 100644 --- a/build.xml +++ b/build.xml @@ -46,7 +46,7 @@ + includes="JettyLauncher.class,CustomConnector.class"/> diff --git a/src/main/java/JettyLauncher.java b/src/main/java/JettyLauncher.java index c56398b..5edba71 100644 --- a/src/main/java/JettyLauncher.java +++ b/src/main/java/JettyLauncher.java @@ -13,7 +13,7 @@ String host = null; int port = 8080; String contextPath = "/"; - boolean httpsScheme = false; + boolean forceHttps = false; for(String arg: args) { if(arg.startsWith("--") && arg.contains("=")) { @@ -26,7 +26,7 @@ } else if(dim[0].equals("--prefix")) { contextPath = dim[1]; } else if(dim[0].equals("--https") && (dim[1].equals("1") || dim[1].equals("true"))) { - httpsScheme = true; + forceHttps = true; } } } @@ -34,7 +34,7 @@ Server server = new Server(); - SslConnector connector = new SslConnector(httpsScheme); + CustomConnector connector = new CustomConnector(forceHttps); if(host != null) { connector.setHost(host); } @@ -58,16 +58,16 @@ } } -class SslConnector extends SelectChannelConnector { - boolean myHttpsScheme; +class CustomConnector extends SelectChannelConnector { + boolean mForceHttps; - public SslConnector(boolean httpsScheme) { - myHttpsScheme = httpsScheme; + public CustomConnector(boolean forceHttps) { + mForceHttps = forceHttps; } @Override public void customize(final EndPoint endpoint, final Request request) throws IOException { - if (myHttpsScheme) { + if (mForceHttps) { request.setScheme("https"); super.customize(endpoint, request); }