2 * ========================LICENSE_START=================================
\r
5 * Copyright (C) 2023-2024 OpenInfra Foundation Europe.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ========================LICENSE_END===================================
\r
21 package org.oransc.nonrtric.sample.rest;
\r
23 import jakarta.servlet.http.HttpServletRequest;
\r
24 import org.slf4j.Logger;
\r
25 import org.slf4j.LoggerFactory;
\r
26 import org.springframework.web.bind.annotation.RequestMapping;
\r
27 import org.springframework.web.bind.annotation.RestController;
\r
30 public class HelloWorldController {
\r
32 private static final Logger logger = LoggerFactory.getLogger(HelloWorldController.class);
\r
34 @RequestMapping("/helloworld/v1")
\r
35 public String helloWorld(HttpServletRequest request) {
\r
36 String path = logRequestPath(request);
\r
37 return "Hello from "+path;
\r
40 @RequestMapping("/helloworld/v1/subpath1")
\r
41 public String helloWorldSubpath1(HttpServletRequest request) {
\r
42 String path = logRequestPath(request);
\r
43 return "Hello from "+path;
\r
46 @RequestMapping("/helloworld2/v1")
\r
47 public String helloWorld2(HttpServletRequest request) {
\r
48 String path = logRequestPath(request);
\r
49 return "Hello from "+path;
\r
52 @RequestMapping("/helloworld/v2")
\r
53 public String helloWorldV2(HttpServletRequest request) {
\r
54 String path = logRequestPath(request);
\r
55 return "Hello from "+path;
\r
58 @RequestMapping("/helloworld/v2/subpath1")
\r
59 public String helloWorldSubpath1V2(HttpServletRequest request) {
\r
60 String path = logRequestPath(request);
\r
61 return "Hello from "+path;
\r
64 private String logRequestPath(HttpServletRequest request) {
\r
65 String path = request.getRequestURI();
\r
66 logger.info("Received request for path: {}", path);
\r