summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/onboarding-rest-war/src/main
diff options
context:
space:
mode:
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>