aboutsummaryrefslogtreecommitdiffstats
path: root/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java
blob: 2956943f7ebbac75e1322225c74fbe6548460279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package org.onap.config.impl;

import org.onap.config.Constants;
import org.onap.config.api.Configuration;

import javax.servlet.annotation.WebFilter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;



@WebFilter("/")
public class ConfigurationFilter implements Filter {

  @Override
  public void init(FilterConfig paramFilterConfig) throws ServletException {
    //Use the default behavior
  }

  @Override
  public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse,
                       FilterChain paramFilterChain) throws IOException, ServletException {
    Configuration.tenant.set(Constants.DEFAULT_TENANT);
    try {
      paramFilterChain.doFilter(paramServletRequest, paramServletResponse);
    } finally {
      Configuration.tenant.remove();
    }
  }

  @Override
  public void destroy() {
    //Use the default behavior
  }

}