aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal
diff options
context:
space:
mode:
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java34
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java53
2 files changed, 49 insertions, 38 deletions
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 9932d094..72013395 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
@@ -30,78 +30,78 @@ import org.slf4j.LoggerFactory;
import io.swagger.jersey.config.JerseyJaxrsConfig;
/**
- * REST Jetty Server that uses Jersey Servlets to support JAX-RS Web Services
+ * REST Jetty Server that uses Jersey Servlets to support JAX-RS Web Services.
*/
public class JettyJerseyServer extends JettyServletServer {
/**
- * Swagger API Base Path
+ * Swagger API Base Path.
*/
protected static final String SWAGGER_API_BASEPATH = "swagger.api.basepath";
/**
- * Swagger Context ID
+ * Swagger Context ID.
*/
protected static final String SWAGGER_CONTEXT_ID = "swagger.context.id";
/**
- * Swagger Scanner ID
+ * Swagger Scanner ID.
*/
protected static final String SWAGGER_SCANNER_ID = "swagger.scanner.id";
/**
- * Swagger Pretty Print
+ * Swagger Pretty Print.
*/
protected static final String SWAGGER_PRETTY_PRINT = "swagger.pretty.print";
/**
- * Swagger Packages
+ * Swagger Packages.
*/
protected static final String SWAGGER_INIT_PACKAGES_PARAM_VALUE = "io.swagger.jaxrs.listing";
/**
- * Jersey Packages Init Param Name
+ * Jersey Packages Init Param Name.
*/
protected static final String JERSEY_INIT_PACKAGES_PARAM_NAME = "jersey.config.server.provider.packages";
/**
- * Jersey Packages Init Param Value
+ * Jersey Packages Init Param Value.
*/
protected static final String JERSEY_INIT_PACKAGES_PARAM_VALUE = "com.fasterxml.jackson.jaxrs.json";
/**
- * Jersey Classes Init Param Name
+ * Jersey Classes Init Param Name.
*/
protected static final String JERSEY_INIT_CLASSNAMES_PARAM_NAME = "jersey.config.server.provider.classnames";
/**
- * Jersey Jackson Classes Init Param Value
+ * Jersey Jackson Classes Init Param Value.
*/
protected static final String JERSEY_JACKSON_INIT_CLASSNAMES_PARAM_VALUE =
"com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider";
/**
- * Jersey Swagger Classes Init Param Value
+ * Jersey Swagger Classes Init Param Value.
*/
protected static final String SWAGGER_INIT_CLASSNAMES_PARAM_VALUE =
"io.swagger.jaxrs.listing.ApiListingResource," + "io.swagger.jaxrs.listing.SwaggerSerializers";
/**
- * Logger
+ * Logger.
*/
protected static Logger logger = LoggerFactory.getLogger(JettyJerseyServer.class);
/**
- * Container for servlets
+ * Container for servlets.
*/
protected HashMap<String, ServletHolder> servlets = new HashMap<>();
/**
- * Swagger ID
+ * Swagger ID.
*/
protected String swaggerId = null;
/**
- * Constructor
+ * Constructor.
*
* @param name name
* @param https enable https?
@@ -122,7 +122,7 @@ public class JettyJerseyServer extends JettyServletServer {
}
/**
- * attaches a swagger initialization servlet
+ * Attaches a swagger initialization servlet.
*/
protected void attachSwaggerServlet(boolean https) {
@@ -146,7 +146,7 @@ public class JettyJerseyServer extends JettyServletServer {
}
/**
- * retrieves cached server based on servlet path
+ * Retrieves cached server based on servlet path.
*
* @param servletPath servlet path
* @return the jetty servlet holder
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 b22a9401..b866a81e 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
@@ -43,12 +43,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Http Server implementation using Embedded Jetty
+ * Http Server implementation using Embedded Jetty.
*/
public abstract class JettyServletServer implements HttpServletServer, Runnable {
/**
- * Keystore/Truststore system property names
+ * Keystore/Truststore system property names.
*/
public static final String SYSTEM_KEYSTORE_PROPERTY_NAME = "javax.net.ssl.keyStore";
public static final String SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME = "javax.net.ssl.keyStorePassword";
@@ -56,67 +56,67 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
public static final String SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME = "javax.net.ssl.trustStorePassword";
/**
- * Logger
+ * Logger.
*/
private static Logger logger = LoggerFactory.getLogger(JettyServletServer.class);
/**
- * server name
+ * Server name.
*/
protected final String name;
/**
- * server host address
+ * Server host address.
*/
protected final String host;
/**
- * server port to bind
+ * Server port to bind.
*/
protected final int port;
/**
- * server auth user name
+ * Server auth user name.
*/
protected String user;
/**
- * server auth password name
+ * Server auth password name.
*/
protected String password;
/**
- * server base context path
+ * Server base context path.
*/
protected final String contextPath;
/**
- * embedded jetty server
+ * Embedded jetty server.
*/
protected final Server jettyServer;
/**
- * servlet context
+ * Servlet context.
*/
protected final ServletContextHandler context;
/**
- * jetty connector
+ * Jetty connector.
*/
protected final ServerConnector connector;
/**
- * jetty thread
+ * Jetty thread.
*/
protected volatile Thread jettyThread;
/**
- * start condition
+ * Start condition.
*/
protected Object startCondition = new Object();
/**
- * constructor
+ * Constructor.
*
* @param name server name
* @param host server host
@@ -159,11 +159,12 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
this.jettyServer = new Server();
this.jettyServer.setRequestLog(new Slf4jRequestLog());
- if (https)
+ if (https) {
this.connector = httpsConnector();
- else
+ } else {
this.connector = httpConnector();
-
+ }
+
this.connector.setName(srvName);
this.connector.setReuseAddress(true);
this.connector.setPort(port);
@@ -200,8 +201,9 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
sslContextFactory.setKeyStorePath(keyStore);
String ksPassword = System.getProperty(SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME);
- if (ksPassword != null)
+ if (ksPassword != null) {
sslContextFactory.setKeyStorePassword(ksPassword);
+ }
}
String trustStore = System.getProperty(SYSTEM_TRUSTSTORE_PROPERTY_NAME);
@@ -209,8 +211,9 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
sslContextFactory.setTrustStorePath(trustStore);
String tsPassword = System.getProperty(SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME);
- if (tsPassword != null)
+ if (tsPassword != null) {
sslContextFactory.setTrustStorePassword(tsPassword);
+ }
}
HttpConfiguration https = new HttpConfiguration();
@@ -261,7 +264,7 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
}
/**
- * jetty server execution
+ * jetty server execution.
*/
@Override
public void run() {
@@ -425,6 +428,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
}
/**
+ * Get name.
+ *
* @return the name
*/
public String getName() {
@@ -432,6 +437,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
}
/**
+ * Get host.
+ *
* @return the host
*/
public String getHost() {
@@ -439,6 +446,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
}
/**
+ * Get user.
+ *
* @return the user
*/
public String getUser() {
@@ -446,6 +455,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
}
/**
+ * Get password.
+ *
* @return the password
*/
@JsonIgnore