--- /dev/null
+/*-\r
+ * ========================LICENSE_START=================================\r
+ * O-RAN-SC\r
+ * %%\r
+ * Copyright (C) 2023-2024 OpenInfra Foundation Europe.\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
+\r
+package org.oransc.nonrtric.sample.rest;\r
+\r
+import jakarta.servlet.http.HttpServletRequest;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.web.bind.annotation.RequestMapping;\r
+import org.springframework.web.bind.annotation.RestController;\r
+\r
+@RestController\r
+public class HelloWorldController {\r
+\r
+ private static final Logger logger = LoggerFactory.getLogger(HelloWorldController.class);\r
+\r
+ @RequestMapping("/helloworld/v1")\r
+ public String helloWorld(HttpServletRequest request) {\r
+ String path = logRequestPath(request);\r
+ return "Hello from "+path;\r
+ }\r
+\r
+ @RequestMapping("/helloworld/v1/subpath1")\r
+ public String helloWorldSubpath1(HttpServletRequest request) {\r
+ String path = logRequestPath(request);\r
+ return "Hello from "+path;\r
+ }\r
+\r
+ @RequestMapping("/helloworld2/v1")\r
+ public String helloWorld2(HttpServletRequest request) {\r
+ String path = logRequestPath(request);\r
+ return "Hello from "+path;\r
+ }\r
+\r
+ @RequestMapping("/helloworld/v2")\r
+ public String helloWorldV2(HttpServletRequest request) {\r
+ String path = logRequestPath(request);\r
+ return "Hello from "+path;\r
+ }\r
+\r
+ @RequestMapping("/helloworld/v2/subpath1")\r
+ public String helloWorldSubpath1V2(HttpServletRequest request) {\r
+ String path = logRequestPath(request);\r
+ return "Hello from "+path;\r
+ }\r
+\r
+ private String logRequestPath(HttpServletRequest request) {\r
+ String path = request.getRequestURI();\r
+ logger.info("Received request for path: {}", path);\r
+ return path;\r
+ }\r
+}\r