From 011cdf2d4fa47ab078061d3700a95c3d3764e5e0 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Tue, 14 Aug 2018 16:43:53 -0400 Subject: Fix checkstyle comments etc. Adding javadoc comments, renaming variables names, fixed whitespace and 120 length. Also some variables were made final since they were declared further from usage. Splitting out Asserts. Still remaining are the abbreviations. Issue-ID: POLICY-881 Change-Id: I31ce5a9eea02578bce023c0c607a19108bb726fa Signed-off-by: Pamela Dragosh --- .../http/client/internal/JerseyClient.java | 16 +++++++++++++++- .../http/server/internal/JettyJerseyServer.java | 4 +--- .../http/server/internal/JettyServletServer.java | 21 +++++++++++++-------- 3 files changed, 29 insertions(+), 12 deletions(-) (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http') diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java index 0454e54b..1fc00bfe 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java @@ -61,7 +61,21 @@ public class JerseyClient implements HttpClient { protected boolean alive = true; - + /** + * Constructor. + * + * @param name the name + * @param https is it https or not + * @param selfSignedCerts are there self signed certs + * @param hostname the hostname + * @param port port being used + * @param basePath base context + * @param userName user + * @param password password + * + * @throws KeyManagementException key exception + * @throws NoSuchAlgorithmException no algorithm exception + */ public JerseyClient(String name, boolean https, boolean selfSignedCerts, String hostname, int port, String basePath, String userName, String password) throws KeyManagementException, NoSuchAlgorithmException { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java index 72013395..a97a9bf5 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java @@ -20,15 +20,13 @@ package org.onap.policy.common.endpoints.http.server.internal; +import io.swagger.jersey.config.JerseyJaxrsConfig; import java.util.HashMap; - import org.eclipse.jetty.servlet.ServletHolder; import org.onap.policy.common.utils.network.NetworkUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.swagger.jersey.config.JerseyJaxrsConfig; - /** * REST Jetty Server that uses Jersey Servlets to support JAX-RS Web Services. */ diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java index b866a81e..7d37521e 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java @@ -127,8 +127,6 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable */ public JettyServletServer(String name, boolean https, String host, int port, String contextPath) { String srvName = name; - String srvHost = host; - String ctxtPath = contextPath; if (srvName == null || srvName.isEmpty()) { srvName = "http-" + port; @@ -138,10 +136,12 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable throw new IllegalArgumentException("Invalid Port provided: " + port); } + String srvHost = host; if (srvHost == null || srvHost.isEmpty()) { srvHost = "localhost"; } + String ctxtPath = contextPath; if (ctxtPath == null || ctxtPath.isEmpty()) { ctxtPath = "/"; } @@ -179,20 +179,25 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } @Override - public void addFilterClass(String aFilterPath, String aFilterClass) { - if (aFilterClass == null || aFilterClass.isEmpty()) { + public void addFilterClass(String filterPath, String filterClass) { + if (filterClass == null || filterClass.isEmpty()) { throw new IllegalArgumentException("No filter class provided"); } - String filterPath = aFilterPath; - if (aFilterPath == null || aFilterPath.isEmpty()) { - filterPath = "/*"; + String tempFilterPath = filterPath; + if (filterPath == null || filterPath.isEmpty()) { + tempFilterPath = "/*"; } - context.addFilter(aFilterClass, filterPath, + context.addFilter(filterClass, tempFilterPath, EnumSet.of(DispatcherType.INCLUDE, DispatcherType.REQUEST)); } + /** + * Returns the https connector. + * + * @return + */ public ServerConnector httpsConnector() { SslContextFactory sslContextFactory = new SslContextFactory(); -- cgit 1.2.3-korg