Skip to content

Instantly share code, notes, and snippets.

@willianantunes
Last active August 11, 2018 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willianantunes/eb5a7eb0baea2c370282300d002fe556 to your computer and use it in GitHub Desktop.
Save willianantunes/eb5a7eb0baea2c370282300d002fe556 to your computer and use it in GitHub Desktop.
@PostMapping(path = REQUEST_PATH_JASMINE, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<?> jasmine(@RequestParam(HONEST_JASMINE_AJAX_PARAMETER) Optional<String> sample) throws InterruptedException {
var maybeEmptySample = sample.map(s -> s.isEmpty()? null : s);
LOGGER.info("Looking for {}", maybeEmptySample);
TimeUnit.SECONDS.sleep(2);
return ok(new Object() {
String message = "Pois é! Você estava procurando por " + maybeEmptySample.orElse("NADA") + " de fato!";
public String getMessage() {
return message;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment