diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2020-03-05 15:30:45 +0000 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2020-03-05 21:03:27 +0000 |
commit | c46ebbb0f011a1587c3fe506c5029ce550b07ed2 (patch) | |
tree | 4b6677c045ebfb8c44254c75209f69a8daa444f6 /sliapi/springboot/src/main/java | |
parent | 99889c1924876d65cf3402c5ddb299a7e4177aad (diff) |
update sliapi-springboot
add sample log4j2 config for spring boot sli api
Issue-ID: CCSDK-2161
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: If24315ad6cad1061d1e65e080f4122605b05df47
Diffstat (limited to 'sliapi/springboot/src/main/java')
6 files changed, 165 insertions, 4 deletions
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/App.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/App.java index 941c1d518..67f549145 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/App.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/App.java @@ -1,3 +1,23 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CCSDK
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.ccsdk.sli.core.sliapi.springboot;
import org.springframework.boot.SpringApplication;
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/ExecuteGraphController.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/ExecuteGraphController.java index efdefbd6f..809cfe59c 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/ExecuteGraphController.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/ExecuteGraphController.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CCSDK + * ================================================================================ + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.ccsdk.sli.core.sliapi.springboot.controllers; import java.util.HashMap; @@ -25,14 +45,10 @@ import com.google.gson.JsonParser; public class ExecuteGraphController { @Autowired protected SvcLogicServiceBase svc; - private static final Logger LOGGER = LoggerFactory.getLogger(ExecuteGraphController.class); @RequestMapping(value = "/executeGraph", method = RequestMethod.POST) @ResponseBody public HashMap<String, String> executeGraph(@RequestBody String input) { - LOGGER.error("In request"); - LOGGER.error(input); - HashMap<String, String> hash = new HashMap<String, String>(); Properties parms = new Properties(); diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/swagger/RestconfApiController.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/swagger/RestconfApiController.java index 10442d432..2972cd791 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/swagger/RestconfApiController.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/controllers/swagger/RestconfApiController.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CCSDK + * ================================================================================ + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.ccsdk.sli.core.sliapi.springboot.controllers.swagger; import java.util.Map; diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/ServletFilters.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/ServletFilters.java new file mode 100644 index 000000000..c56cf3bf1 --- /dev/null +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/ServletFilters.java @@ -0,0 +1,42 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CCSDK
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sliapi.springboot.core;
+
+import javax.servlet.ServletException;
+
+import org.onap.logging.filter.base.PayloadLoggingServletFilter;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ServletFilters {
+
+ @Bean
+ public FilterRegistrationBean<PayloadLoggingServletFilter> payloadFilterRegistration() throws ServletException {
+ FilterRegistrationBean<PayloadLoggingServletFilter> registration = new FilterRegistrationBean<PayloadLoggingServletFilter>();
+ registration.setFilter(new PayloadLoggingServletFilter());
+ registration.addUrlPatterns("/*");
+ registration.setName("payloadFilter");
+ registration.setOrder(0);
+ return registration;
+ }
+}
\ No newline at end of file diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java index f39fc229c..a6bda81ae 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java @@ -1,3 +1,23 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CCSDK
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.ccsdk.sli.core.sliapi.springboot.core;
import java.io.FileInputStream;
diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java new file mode 100644 index 000000000..fb4fe0858 --- /dev/null +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java @@ -0,0 +1,43 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CCSDK
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sliapi.springboot.core;
+
+import org.onap.logging.filter.spring.LoggingInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@EnableWebMvc
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+ @Bean
+ LoggingInterceptor loggingInterceptor() {
+ return new LoggingInterceptor();
+ }
+
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(loggingInterceptor()); // handles audit log entries
+ }
+
+}
\ No newline at end of file |