diff options
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/IndexedHttpServletServerFactory.java')
-rw-r--r-- | policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/IndexedHttpServletServerFactory.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/IndexedHttpServletServerFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/IndexedHttpServletServerFactory.java index e977f02c..86f5fb04 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/IndexedHttpServletServerFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/IndexedHttpServletServerFactory.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -137,9 +138,12 @@ class IndexedHttpServletServerFactory implements HttpServletServerFactory { final var restUriPath = props.getString(PolicyEndPointProperties.PROPERTY_HTTP_REST_URIPATH_SUFFIX, null); addFilterClasses(props, service, restUriPath); - addServletClasses(props, service, restUriPath); + addRestServletClasses(props, service, restUriPath); addServletPackages(props, service, restUriPath); + addServletClass(props, service); + setPrometheus(props, service); + serviceList.add(service); } @@ -167,6 +171,12 @@ class IndexedHttpServletServerFactory implements HttpServletServerFactory { } } + private void setPrometheus(PropertyUtils props, HttpServletServer service) { + if (props.getBoolean(PolicyEndPointProperties.PROPERTY_HTTP_PROMETHEUS_SUFFIX, false)) { + service.setPrometheus("/metrics"); + } + } + private void addFilterClasses(PropertyUtils props, HttpServletServer service, final String restUriPath) { final var filterClasses = @@ -179,8 +189,7 @@ class IndexedHttpServletServerFactory implements HttpServletServerFactory { } } - private void addServletClasses(PropertyUtils props, HttpServletServer service, final String restUriPath) { - + private void addRestServletClasses(PropertyUtils props, HttpServletServer service, final String restUriPath) { final var restClasses = props.getString(PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, null); if (!StringUtils.isBlank(restClasses)) { @@ -190,6 +199,15 @@ class IndexedHttpServletServerFactory implements HttpServletServerFactory { } } + private void addServletClass(PropertyUtils props, HttpServletServer service) { + var servletClass = props.getString(PolicyEndPointProperties.PROPERTY_HTTP_SERVLET_CLASS_SUFFIX, null); + var servletUriPath = props.getString(PolicyEndPointProperties.PROPERTY_HTTP_SERVLET_URIPATH_SUFFIX, null); + + if (!StringUtils.isBlank(servletClass) && !StringUtils.isBlank(servletUriPath)) { + service.addStdServletClass(servletUriPath, servletClass); + } + } + private void addServletPackages(PropertyUtils props, HttpServletServer service, final String restUriPath) { final var restPackages = props.getString(PolicyEndPointProperties.PROPERTY_HTTP_REST_PACKAGES_SUFFIX, null); |