private final String from;
- @PostMapping("{to}")
- public GreetingTO greet(
+ @RequestableByHumans
+ @PostMapping("/greet/{to}")
+ public MessageTo greet(
@PathVariable String to,
@RequestBody String greeting)
{
log.info("Greeting from {} to {}: {}", from, to, message);
- return GreetingTO.of(message, from, to);
+ return MessageTo.of(message, from, to);
+ }
+
+ @PostMapping("/acknowledge/{to}")
+ public MessageTo acknowledge(
+ @PathVariable String to,
+ @RequestBody String acknowledgment)
+ {
+ String message = acknowledgment
+ .replaceAll(PLACEHOLDER_FROM, from)
+ .replaceAll(PLACEHOLDER_TO, to)
+ .trim();
+
+ log.info("Acknowledgement from {} to {}: {}", from, to, message);
+
+ return MessageTo.of(message, from, to);
}
}