- SslContextFactory sslContextFactory = getSslContextFactory(provProps);
-
- // HTTPS configuration
- HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
- httpsConfiguration.setRequestHeaderSize(8192);
-
- // HTTPS connector
- try (ServerConnector httpsServerConnector = new ServerConnector(server,
- new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
- new HttpConnectionFactory(httpsConfiguration))) {
- httpsServerConnector.setPort(httpsPort);
- httpsServerConnector.setIdleTimeout(30000);
- httpsServerConnector.setAcceptQueueSize(2);
-
- ServletContextHandler servletContextHandler = getServletContextHandler(provProps);
- ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
- contextHandlerCollection.addHandler(servletContextHandler);
-
- // Server's Handler collection
- HandlerCollection handlerCollection = new HandlerCollection();
- handlerCollection.setHandlers(new Handler[]{contextHandlerCollection, new DefaultHandler()});
- handlerCollection.addHandler(requestLogHandler);
-
- server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
- server.setHandler(handlerCollection);
+ ServletContextHandler servletContextHandler = getServletContextHandler(provProps);
+ ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
+ contextHandlerCollection.addHandler(servletContextHandler);
+
+ CustomRequestLog customRequestLog = getCustomRequestLog(provProps);
+ RequestLogHandler requestLogHandler = new RequestLogHandler();
+ requestLogHandler.setRequestLog(customRequestLog);
+
+ server.setRequestLog(customRequestLog);
+
+ // Server's Handler collection
+ HandlerCollection handlerCollection = new HandlerCollection();
+ handlerCollection.setHandlers(new Handler[]{contextHandlerCollection, new DefaultHandler()});
+ handlerCollection.addHandler(requestLogHandler);
+
+ if (Boolean.TRUE.equals(ProvRunner.getTlsEnabled())) {
+ // HTTPS configuration
+ int httpsPort = Integer.parseInt(
+ provProps.getProperty("org.onap.dmaap.datarouter.provserver.https.port", "443"));
+ httpConfiguration.setSecureScheme("https");
+ httpConfiguration.setSecurePort(httpsPort);
+ HttpConfiguration httpsConfiguration = new HttpConfiguration(httpConfiguration);
+ httpsConfiguration.setRequestHeaderSize(8192);
+ // HTTPS connector
+ try (ServerConnector httpsServerConnector = new ServerConnector(server,
+ new SslConnectionFactory(getSslContextFactory(provProps), HttpVersion.HTTP_1_1.asString()),
+ new HttpConnectionFactory(httpsConfiguration))) {
+ httpsServerConnector.setPort(httpsPort);
+ httpsServerConnector.setIdleTimeout(30000);
+ httpsServerConnector.setAcceptQueueSize(2);
+ server.setConnectors(new Connector[]{httpServerConnector, httpsServerConnector});
+ }
+ } else {
+ server.setConnectors(new Connector[]{httpServerConnector});