diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2021-08-30 17:35:18 +0100 |
---|---|---|
committer | Daniel Hanrahan <daniel.hanrahan@est.tech> | 2021-09-07 08:22:23 +0000 |
commit | a8af9621cd5be96dc802710078bae90400f6792a (patch) | |
tree | 269bf18fec38852cdbbd5e5c0d0c5ff67dd3e356 /gui-pdp-monitoring/src/main/java | |
parent | a023942e415b1f0a5dfb40a1d8315b66cc951dad (diff) |
Make gui-pdp-monitoring work in Docker image
Serve PDP Monitoring HTML using nginx in Docker image
Don't serve HTML content from PdpMonitoringServer
Remove unused dependencies in gui-pdp-monitoring
Add proxy setting for local dev testing with npm start
Issue-ID: POLICY-3603
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I9a4c2b250a1f0460892a367a3b5bbb59e0e92411
Diffstat (limited to 'gui-pdp-monitoring/src/main/java')
3 files changed, 4 insertions, 24 deletions
diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java index 398cbc4..2c0bb3a 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringMain.java @@ -152,7 +152,7 @@ public class PdpMonitoringMain { public void shutdown() { if (pdpMonitoringServer != null) { LOGGER.info(PDP_MONITORING_PREFIX + "{}) shutting down", this); - pdpMonitoringServer.shutdown(parameters.getPort(), parameters.getDefaultRestPort()); + pdpMonitoringServer.shutdown(parameters.getPort()); } shutdownLatch.countDown(); state = ServicesState.STOPPED; diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java index 78e048d..bfb273d 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServer.java @@ -22,7 +22,6 @@ package org.onap.policy.gui.pdp.monitoring; import lombok.NonNull; -import org.eclipse.jetty.servlets.CrossOriginFilter; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.slf4j.Logger; @@ -41,9 +40,6 @@ public class PdpMonitoringServer { // The HTTP server exposing JAX-RS resources defined in this application. private HttpServletServer jerseyServer; - // The HTTP server exposing static resources defined in this application. - private HttpServletServer staticResourceServer; - /** * Starts the HTTP server for the Pdp statistics monitoring on the default base URI and with the * default REST packages. @@ -58,34 +54,23 @@ public class PdpMonitoringServer { * @param parameters The Pdp parameters to use to start the server. */ public PdpMonitoringServer(@NonNull final PdpMonitoringServerParameters parameters) { - LOGGER.debug("Pdp Monitoring starting . . ."); jerseyServer = HttpServletServerFactoryInstance.getServerFactory().build("PDP Monitoring Rest Server", false, - parameters.getServerHost(), parameters.getDefaultRestPort(), parameters.getContextPath(), false, true); + parameters.getServerHost(), parameters.getPort(), parameters.getContextPath(), false, true); jerseyServer.addServletPackage(parameters.getDefaultRestPath(), parameters.getRestPackage()); - jerseyServer.addFilterClass(parameters.getDefaultRestPath(), CrossOriginFilter.class.getName()); jerseyServer.start(); - staticResourceServer = HttpServletServerFactoryInstance.getServerFactory().buildStaticResourceServer( - "PDP Monitoring Html Server", false, parameters.getServerHost(), parameters.getPort(), - parameters.getContextPath(), true); - staticResourceServer.addServletResource(null, - PdpMonitoringServer.class.getClassLoader().getResource("webapp").toExternalForm()); - staticResourceServer.start(); - LOGGER.debug("Pdp Monitoring started"); } /** * Shut down the web server. * - * @param htmlPort port number of static resource server * @param restPort port number of jersey server */ - public void shutdown(int htmlPort, int restPort) { + public void shutdown(int restPort) { LOGGER.debug("Pdp Monitoring . . ."); - HttpServletServerFactoryInstance.getServerFactory().destroy(htmlPort); HttpServletServerFactoryInstance.getServerFactory().destroy(restPort); LOGGER.debug("Pdp Monitoring shut down"); } diff --git a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java index a76fa02..78fb479 100644 --- a/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java +++ b/gui-pdp-monitoring/src/main/java/org/onap/policy/gui/pdp/monitoring/PdpMonitoringServerParameters.java @@ -38,7 +38,6 @@ import org.onap.policy.common.parameters.annotations.Min; @Getter @Setter public class PdpMonitoringServerParameters { - public static final int DEFAULT_PORT = 18999; public static final int INFINITY_TIME_TO_LIVE = -1; // Base URI the HTTP server will listen on @@ -55,7 +54,7 @@ public class PdpMonitoringServerParameters { @Min(1024) @Max(65534) - private int port = DEFAULT_PORT; + private int port = DEFAULT_REST_PORT; @Min(-1) private long timeToLive = INFINITY_TIME_TO_LIVE; @@ -88,8 +87,4 @@ public class PdpMonitoringServerParameters { public String getDefaultRestPath() { return "/" + DEFAULT_REST_PATH; } - - public int getDefaultRestPort() { - return DEFAULT_REST_PORT; - } } |