aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-02-08 09:30:02 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-02-08 12:38:37 +0000
commit2d2e0b503f915a81ae9a02dfa3afac3de369efde (patch)
treeb05555ebaca90f1d620f4562067bf486731ee48c /openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main
parent89f96b17aed5c432be3df6d75a49a1f9ebc9120b (diff)
Onboarding foundation changes
1. Adding OnboardingSessionContextFilter which sets tenant(kespace) for onboarding application 2. Different services can extend SessionContextFilter to set their own keyspace 3. These changes in onboarding are done to support services like ActivitySpec Change-Id: Ia62557354ab05235d027250af94a2835d741b7fa Issue-ID: SDC-1005 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/OnboardingSessionContextFilter.java21
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java45
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java3
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml2
4 files changed, 25 insertions, 46 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/OnboardingSessionContextFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/OnboardingSessionContextFilter.java
new file mode 100644
index 0000000000..7166f627e4
--- /dev/null
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/OnboardingSessionContextFilter.java
@@ -0,0 +1,21 @@
+package org.openecomp.server.filters;
+
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.sdcrests.filters.SessionContextFilter;
+
+public class OnboardingSessionContextFilter extends SessionContextFilter {
+
+ @Override
+ public String getUser(ServletRequest servletRequest) {
+ return ((HttpServletRequest) servletRequest).getHeader(USER_ID_HEADER_PARAM);
+ }
+
+ @Override
+ public String getTenant(ServletRequest servletRequest) {
+ return "dox";
+ }
+}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java
deleted file mode 100644
index b317fa6bf5..0000000000
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/filters/SessionContextFilter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.openecomp.server.filters;
-
-import org.openecomp.sdc.common.session.SessionContextProvider;
-import org.openecomp.sdc.common.session.SessionContextProviderFactory;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-
-public class SessionContextFilter implements Filter {
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
-
- }
-
- @Override
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
- FilterChain filterChain) throws IOException, ServletException {
- SessionContextProvider contextProvider =
- SessionContextProviderFactory.getInstance().createInterface();
-
- try {
- if (servletRequest instanceof HttpServletRequest) {
- String userName = ((HttpServletRequest) servletRequest).getHeader(USER_ID_HEADER_PARAM);
- contextProvider.create(userName);
- }
-
- filterChain.doFilter(servletRequest, servletResponse);
- } finally {
- contextProvider.close();
- }
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java
index 2ea0ee2f66..b1c818cabb 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/java/org/openecomp/server/listeners/OnboardingAppStartupListener.java
@@ -21,6 +21,7 @@
package org.openecomp.server.listeners;
+import org.openecomp.sdc.common.session.SessionContextProviderFactory;
import org.springframework.web.context.ContextLoaderListener;
import javax.servlet.ServletContextEvent;
@@ -32,6 +33,8 @@ public class OnboardingAppStartupListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
+ SessionContextProviderFactory.getInstance().createInterface().create("onboarding",
+ "dox");
springListener = new ContextLoaderListener();
springListener.initWebApplicationContext(servletContextEvent.getServletContext());
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
index de88197a8a..64be5ab20c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main/webapp/WEB-INF/web.xml
@@ -83,7 +83,7 @@
</filter-mapping>
<filter>
<filter-name>SessionContextFilter</filter-name>
- <filter-class>org.openecomp.server.filters.SessionContextFilter</filter-class>
+ <filter-class>org.openecomp.server.filters.OnboardingSessionContextFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SessionContextFilter</filter-name>