Code formatting of configuration framework
[sdc.git] / common / onap-common-configuration-management / onap-configuration-management-core / src / main / java / org / onap / config / impl / ConfigurationFilter.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.config.impl;
18
19 import java.io.IOException;
20 import javax.servlet.Filter;
21 import javax.servlet.FilterChain;
22 import javax.servlet.FilterConfig;
23 import javax.servlet.ServletException;
24 import javax.servlet.ServletRequest;
25 import javax.servlet.ServletResponse;
26 import javax.servlet.annotation.WebFilter;
27 import org.onap.config.Constants;
28 import org.onap.config.api.Configuration;
29
30
31 @WebFilter("/")
32 public class ConfigurationFilter implements Filter {
33
34     @Override
35     public void init(FilterConfig paramFilterConfig) {
36         //Use the default behavior
37     }
38
39     @Override
40     public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse,
41             FilterChain paramFilterChain) throws IOException, ServletException {
42         Configuration.TENANT.set(Constants.DEFAULT_TENANT);
43         try {
44             paramFilterChain.doFilter(paramServletRequest, paramServletResponse);
45         } finally {
46             Configuration.TENANT.remove();
47         }
48     }
49
50     @Override
51     public void destroy() {
52         //Use the default behavior
53     }
54
55 }