From: Gustavo Martin Morcuende Date: Tue, 8 Sep 2015 23:39:35 +0000 (+0200) Subject: SpringJava REST: CarController, commit related to X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=7a8b679aba9f1db358913596d7b5e85366613736;p=JavaForFun SpringJava REST: CarController, commit related to https://github.com/gumartinm/JavaScriptForFun/commit/ee9f818b18022b98b185cc1938a0302381c89329 --- diff --git a/SpringJava/REST/src/main/java/rest/CarController.java b/SpringJava/REST/src/main/java/rest/CarController.java index bb45725..4967da0 100644 --- a/SpringJava/REST/src/main/java/rest/CarController.java +++ b/SpringJava/REST/src/main/java/rest/CarController.java @@ -33,6 +33,13 @@ public class CarController { @RequestMapping(value = "/{id}", produces = { "application/json" }, method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public Car car(@PathVariable("id") long id) { + try { + Thread.sleep(10000); //1000 milliseconds is one second. + } catch(InterruptedException ex) { + Thread.currentThread().interrupt(); + } + + return new Car(counter.incrementAndGet(), String.format(template, id)); } }