BAEL-1416 quick guide to kong (#3448)

* BAEL-1416 quick guide to kong

* refactor kong samples
This commit is contained in:
aietcn
2018-01-20 17:09:55 +08:00
committed by Grzegorz Piwowarek
parent 3ecab4a0df
commit 7e7ccc7eb3
11 changed files with 471 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
package com.baeldung.kong;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author aiet
*/
@RestController
@RequestMapping("/stock")
public class QueryController {
private static int REQUEST_COUNTER = 0;
@GetMapping("/reqcount")
public int getReqCount(){
return REQUEST_COUNTER;
}
@GetMapping("/{code}")
public String getStockPrice(@PathVariable String code){
REQUEST_COUNTER++;
if("BTC".equalsIgnoreCase(code))
return "10000";
else return "N/A";
}
}