+++ /dev/null
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- * * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- * * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cadi.filter;\r
-\r
-import javax.servlet.FilterConfig;\r
-import javax.servlet.ServletContext;\r
-\r
-import org.onap.aaf.cadi.Access;\r
-import org.onap.aaf.cadi.Access.Level;\r
-import org.onap.aaf.cadi.config.Get;\r
-\r
-/*\r
- * A private method to query the Filter config and if not exists, return the default. This\r
- * cleans up the initialization code.\r
- */\r
-class FCGet implements Get {\r
- /**\r
- * \r
- */\r
- private final Access access;\r
- private FilterConfig filterConfig;\r
- private ServletContext context;\r
-\r
- public FCGet(Access access, ServletContext context, FilterConfig filterConfig) {\r
- this.access = access;\r
- this.context = context;\r
- this.filterConfig = filterConfig;\r
- }\r
-\r
- public String get(String name, String def, boolean print) {\r
- String str = null;\r
- // Try Server Context First\r
- if(context!=null) {\r
- str = context.getInitParameter(name);\r
- }\r
- \r
- // Try Filter Context next\r
- if(str==null && filterConfig != null) {\r
- str = filterConfig.getInitParameter(name);\r
- }\r
- \r
- if(str==null) {\r
- str = access.getProperty(name, def);\r
- }\r
- // Take def if nothing else\r
- if(str==null) {\r
- str = def;\r
- // don't log defaults\r
- } else {\r
- str = str.trim(); // this is vital in Property File based values, as spaces can hide easily\r
- if(print) {\r
- access.log(Level.INFO,"Setting", name, "to", str);\r
- }\r
- }\r
- return str;\r
- }\r
-}\r