aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/RestServer.java
AgeCommit message (Collapse)AuthorFilesLines
2024-02-07Remove Dmaap references from policy-commonrameshiyer271-22/+6
- updated dependencies for jakarta.* compabilities - other dependency updates for security fixes Issue-ID: POLICY-4881 Change-Id: I979d944fcd21279f618d1bcbfe12e914ba30077f Signed-off-by: rameshiyer27 <ramesh.murugan.iyer@est.tech>
2023-09-21Java 17 Upgradeadheli.tavares1-2/+2
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-03-14Upgrade Jetty and Jerseyliamfallon1-10/+12
The new version of Jetty and Jersey brings in Server Name Checking, which must be eiter enabled or disabled. Also, the bug in Swagger that drags in JUnit 5 with a non "test" scope is worked around by excluding the junit 5 dependencies. Issue-ID: POLICY-4474 Change-Id: Ib5ba23616c8d3cb011c5055a49c9cb325c9fd667 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-08-23Support multiple filters in RestServerJim Hahn1-5/+29
Added an API to RestServer so that multiple Filters may be provided. Issue-ID: POLICY-3531 Change-Id: I21f474c01d58237c744d1d70f5b39c2c90fdb401 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-18Integrating prometheus with Policy componentsa.sreekumar1-0/+9
With this change, all PF components can export prometheus metrics by default. The prometheus metrics servlet will be running on /metrics servletPath.. If the metrics shouldn't be exported, just add a flag "promethus": false in the restServerParameters of default configuration file. This brings up prometheus servlet on /metrics servletPath. Also as part of standard servlet support, "servletUriPath" and "servletClass" are 2 other fields added to RestServerParameters which can be used to add standard servlets. This can be revisited later if needed. Basically, any servlet can be added by passing these fields, for example, to add prometheus metrics servlet on /test/metrics, add the below to restServerParameters: "servletUriPath": "/test/metrics", "servletClass": "io.prometheus.client.exporter.MetricsServlet" In addition, we can later go to individual components and add more metrics, say for e.g., deployedPoliciesCounter/undeployedPoliciesCounter etc on PAP, executedEvents/failedEvents etc on PDP and so on. This will look something like below, for e.g. in policy-pap component: io.prometheus.client.Counter counter = Counter.build() .name("policies_deployed_total") .help("Number of policies deployed.").register() Whenever a policy is deployed, just call counter.inc() Usage of code like above in the individual component will expose such data as well as part of the exposed metrics. Change-Id: Id667f27b15c012398421ba657b5324cc1d82cf1f Issue-ID: POLICY-3524 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca> Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-05-21Enhance toString methods in factory classesJim Hahn1-16/+5
The factory classes in policy-endpoints have toString() methods that return "[]" for their list contents. Updated the code to provide a list of the keys rather than just an empty list. Also replaced some toString() methods with lombok. Also replace StringBuilder with concatenation in some cases. Issue-ID: POLICY-3298 Change-Id: I64fca21a4b009f7e09fcc482b5d156753fb7e680 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-06Fix sonars in policy-commonJim Hahn1-3/+3
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in commonJim Hahn1-2/+2
Addressed the following sonar issues: - missing assertion in junit test case - disable sonars about setAccessible() as it's required for jackson emulation - sleep in junit - don't use wild-cards (e.g., "*") with java.util Pattern - use re2j instead of java.util Pattern - use String methods (e.g., startsWith()) - duplicate method bodies - duplicate code in Coder classes - string concatenation in logger calls - UTF-8 encoding - return primitive instead of boxed primitive - add assertion to tests - renamed support methods from doTestXxx to verifyXxx - cognitive complexity - use AtomicRef instead of volatile - use specific Functionals (e.g., IntConsumer) - function always returns the same value - serializable vs transient Issue-ID: POLICY-2305 Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-02-17Allow storing REST servers password and userName in environment variablesDominik Mizyn1-2/+9
This patch allows to store and get REST servers password and userName from environment variables. This is needed if we want to send those variables by helm secrets. Issue-ID: OOM-2287 Change-Id: I4d6a8bf188a0d17e5444137d871dd341627ec397 Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
2019-09-12Report bad-request for invalid YAMLJim Hahn1-1/+1
Added classes and modified code to report bad-request when a servlet attempts to read invalid YAML. Change-Id: Iacddee92a448fb69d5c778a3c3f3f2b5528983f7 Issue-ID: POLICY-2085 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-11Create StandardYamlCoderJim Hahn1-1/+2
Created StandardYamlCoder which is like a StandardCoder, except that the original converts to/from JSON, while the new class converts to/from YAML. Also added YamlMessageBodyHandler and incorporated it into the http server so that it supports a media type of */yaml. Change-Id: Ibd83a9f6d355a330f63e435f2bb41affcf1947c2 Issue-ID: POLICY-2065 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-23Rest servers should return 400 for bad syntax JSONJim Hahn1-1/+1
Modified common RestServer to inject an exception handler into the list of providers so that it returns 400 instead of 500 for JSON parsing errors. Change-Id: I7c77625e3531e26413d72cc386296a709946cda2 Issue-ID: POLICY-1725 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-31Remove ParameterUtilsJim Hahn1-1/+1
Removed ParameterUtils. Also made RestServer.getServerProperties() protected so it can be overridden. Also fixed issue in TopicParameterGroupTest to prevent it from validating static fields. Change-Id: Icb4580f5802b9edca489a38896d61ad24aece449 Issue-ID: POLICY-1953 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-17Copy PapRestServer to policy/commonJim Hahn1-0/+140
Copied and renamed the class to RestServer. Also modified it to derive from ServiceManagerContainer. Added getName() method to HttpServletServer, which facilitated the refactoring. Renamed "controllers" to "providers". Change-Id: I905166e41063e3fe84e356fd6c4a91ca9d4cb8a6 Issue-ID: POLICY-1652 Signed-off-by: Jim Hahn <jrh3@att.com>