diff options
author | Maharajh, Robby (rx2202) <rx2202@us.att.com> | 2020-09-09 19:57:16 -0400 |
---|---|---|
committer | Maharajh, Robby (rx2202) <rx2202@us.att.com> | 2020-09-09 19:57:19 -0400 |
commit | 134ca0a1494ebd664ab2985c1018627624f29f02 (patch) | |
tree | 05cd83159ad7bf0fab2b0d0cef53725708af6414 /aai-traversal/src/main/java | |
parent | 32928ac8938a6e660f8ed0213c31882423952ddc (diff) |
Update traversal to use spring boot 2
Issue-ID: AAI-2886
Issue-ID: AAI-2527
Change-Id: Id6432ff82b0377ff44115d5b42607d1926431f7b
Signed-off-by: Maharajh, Robby (rx2202) <rx2202@us.att.com>
Diffstat (limited to 'aai-traversal/src/main/java')
5 files changed, 11 insertions, 29 deletions
diff --git a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java index 64f99b9..56573bc 100644 --- a/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java +++ b/aai-traversal/src/main/java/org/onap/aai/TraversalApp.java @@ -116,8 +116,6 @@ public class TraversalApp { @PreDestroy public void cleanup(){ - contextMap = MDC.getCopyOfContextMap(); - MDC.setContextMap (contextMap); logger.debug("Traversal MicroService stopped"); logger.info("Shutting down both realtime and cached connections"); AAIGraph.getInstance().graphShutdown(); diff --git a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java index 9382946..4cfcb91 100644 --- a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java +++ b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafAuthorizationFilter.java @@ -24,7 +24,7 @@ import com.att.eelf.configuration.EELFManager; import org.apache.commons.io.IOUtils; import org.onap.aai.Profiles; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.filter.OrderedRequestContextFilter; +import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; diff --git a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java index 51e0c17..6ab97ac 100644 --- a/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java +++ b/aai-traversal/src/main/java/org/onap/aai/config/aaf/AafFilter.java @@ -25,7 +25,7 @@ import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.aai.Profiles; import org.onap.aai.TraversalApp; -import org.springframework.boot.web.filter.OrderedRequestContextFilter; +import org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; diff --git a/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java index e6cf080..39aa31c 100644 --- a/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java +++ b/aai-traversal/src/main/java/org/onap/aai/web/JerseyConfiguration.java @@ -19,10 +19,8 @@ */ package org.onap.aai.web; -import jersey.repackaged.com.google.common.collect.Sets; -import org.glassfish.jersey.filter.LoggingFilter; +import com.google.common.collect.Sets; import org.glassfish.jersey.server.ResourceConfig; -import org.onap.aai.aailog.logs.AaiDebugLog; import org.onap.aai.rest.*; import org.onap.aai.rest.search.ModelAndNamedQueryRestProvider; import org.onap.aai.rest.search.SearchProvider; @@ -50,11 +48,6 @@ public class JerseyConfiguration { private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName()); private static final org.slf4j.Logger logger = LoggerFactory.getLogger(JerseyConfiguration.class.getName()); - private static AaiDebugLog debugLog = new AaiDebugLog(); - static { - debugLog.setupMDC(); - } - private static final String LOGGING_ENABLED_PROPERTY = "aai.request.logging.enabled"; private static final boolean ENABLE_RESPONSE_LOGGING = false; @@ -80,7 +73,6 @@ public class JerseyConfiguration { CQ2GremlinTest.class ); Set<Class<?>> filterClasses = Sets.newHashSet( - org.onap.aai.aailog.filter.AaiAuditLogContainerFilter.class, org.onap.aai.interceptors.pre.RequestTransactionLogging.class, org.onap.aai.interceptors.pre.HeaderValidation.class, org.onap.aai.interceptors.pre.HttpHeaderInterceptor.class, @@ -94,9 +86,6 @@ public class JerseyConfiguration { org.onap.aai.interceptors.post.ResponseTransactionLogging.class, org.onap.aai.interceptors.post.ResponseHeaderManipulation.class ); - if (isLoggingEnabled()) { - logRequests(resourceConfig); - } resourceConfig.registerClasses(classes); logger.debug("REGISTERED CLASSES " + classes.toString()); @@ -126,10 +115,6 @@ public class JerseyConfiguration { return comparingInt(clazz -> clazz.getAnnotation(Priority.class).value()); } - private void logRequests(ResourceConfig resourceConfig) { - resourceConfig.register(new LoggingFilter(log, ENABLE_RESPONSE_LOGGING)); - } - private boolean isLoggingEnabled() { return parseBoolean(environment.getProperty(LOGGING_ENABLED_PROPERTY)); } diff --git a/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java b/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java index 4bc3300..d2a4e89 100644 --- a/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java +++ b/aai-traversal/src/main/java/org/onap/aai/web/LocalHostAccessLog.java @@ -24,9 +24,8 @@ import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.RequestLogHandler; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; -import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; -import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -35,14 +34,14 @@ import java.util.Arrays; @Configuration public class LocalHostAccessLog { - @Bean - public EmbeddedServletContainerFactory jettyConfigBean( + @Bean + public AbstractServletWebServerFactory jettyConfigBean( @Value("${jetty.threadPool.maxThreads:200}") final String maxThreads, @Value("${jetty.threadPool.minThreads:8}") final String minThreads ){ - JettyEmbeddedServletContainerFactory jef = new JettyEmbeddedServletContainerFactory(); - jef.addServerCustomizers((JettyServerCustomizer) server -> { + JettyServletWebServerFactory jef = new JettyServletWebServerFactory(); + jef.addServerCustomizers((org.springframework.boot.web.embedded.jetty.JettyServerCustomizer) server -> { HandlerCollection handlers = new HandlerCollection(); @@ -63,6 +62,6 @@ public class LocalHostAccessLog { threadPool.setMaxThreads(Integer.valueOf(maxThreads)); threadPool.setMinThreads(Integer.valueOf(minThreads)); }); - return jef; - } + return jef; + } } |