import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer;
@Override
public void start() {
+ String httpPortStr = getDeployProperty(CmsDeployProperty.HTTP_PORT);
+ String httpsPortStr = getDeployProperty(CmsDeployProperty.HTTPS_PORT);
+ if (httpPortStr != null && httpsPortStr != null)
+ throw new IllegalArgumentException("Either an HTTP or an HTTPS port should be configured, not both");
+ if (httpPortStr == null && httpsPortStr == null) {
+ log.warn("Neither an HTTP or an HTTPS port was configured, not starting Jetty");
+ }
+
+ /// TODO make it more generic
+ String httpHost = getDeployProperty(CmsDeployProperty.HOST);
+
try {
ThreadPool threadPool = null;
server = new Server(threadPool);
- configureConnectors();
+ configureConnectors(httpPortStr, httpsPortStr, httpHost);
if (httpConnector != null) {
httpConnector.open();
//
// Addresses
- String httpHost = getDeployProperty(CmsDeployProperty.HOST);
String fallBackHostname = cmsState != null ? cmsState.getHostname() : "::1";
if (httpConnector != null) {
httpAddress = new InetSocketAddress(httpHost != null ? httpHost : fallBackHostname,
}
}
- protected void configureConnectors() {
- String httpPortStr = getDeployProperty(CmsDeployProperty.HTTP_PORT);
- String httpsPortStr = getDeployProperty(CmsDeployProperty.HTTPS_PORT);
- if (httpPortStr != null && httpsPortStr != null)
- throw new IllegalArgumentException("Either an HTTP or an HTTPS port should be configured, not both");
- if (httpPortStr == null && httpsPortStr == null)
- throw new IllegalArgumentException("Neither an HTTP or HTTPS port was configured");
-
- /// TODO make it more generic
- String httpHost = getDeployProperty(CmsDeployProperty.HOST);
+ protected void configureConnectors(String httpPortStr, String httpsPortStr, String httpHost) {
// try {
if (httpPortStr != null || httpsPortStr != null) {