|
| 1 | +/* |
| 2 | + * Copyright (C) open knowledge GmbH |
| 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, |
| 11 | + * software 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 |
| 14 | + * and limitations under the License. |
| 15 | + */ |
| 16 | +package de.openknowledge.workshop.cloud.controllers; |
| 17 | + |
| 18 | +import org.springframework.http.MediaType; |
| 19 | +import org.springframework.web.bind.annotation.GetMapping; |
| 20 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 21 | +import org.springframework.web.bind.annotation.RestController; |
| 22 | + |
| 23 | +import java.util.UUID; |
| 24 | +import java.util.logging.Logger; |
| 25 | + |
| 26 | +@RestController |
| 27 | +@RequestMapping("/") |
| 28 | +public class AppController { |
| 29 | + private static final String RANDOM_UUID = UUID.randomUUID().toString(); |
| 30 | + |
| 31 | + private static final Logger LOGGER = Logger.getLogger( |
| 32 | + AppController.class.getSimpleName() |
| 33 | + ); |
| 34 | + |
| 35 | + @GetMapping(value = "id", produces = MediaType.APPLICATION_JSON_VALUE) |
| 36 | + public String getId() { |
| 37 | + LOGGER.info("RESTful call 'GET id'"); |
| 38 | + |
| 39 | + return RANDOM_UUID; |
| 40 | + } |
| 41 | +} |
0 commit comments