package de.springbootbuch.reactive.filmstore;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * Part of springbootbuch.de.
 * 
 * @author Michael J. Simons
 * @author @rotnroll666
 */
@RestController
public class DemoRestController {
	@GetMapping("/helloworld")
	public Mono<String> getGreeting(
		@RequestParam(defaultValue = "Welt") String name
	) {
		return Mono.just("Hallo")
			.flatMap(s -> Mono
				.just(s + ", " + name + "!\n")
			);
	}
}

@@ -99,16 +99,136 @@
 apping;%0A
+import org.springframework.web.bind.annotation.PostMapping;%0Aimport org.springframework.web.bind.annotation.RequestBody;%0A
 import o
@@ -280,16 +280,16 @@
 tParam;%0A
-
 import o
@@ -343,16 +343,52 @@
 roller;%0A
+import reactor.core.publisher.Flux;%0A
 import r
@@ -764,16 +764,16 @@
  %22!%5Cn%22)%0A
-
 %09%09%09);%0A%09%7D
@@ -773,10 +773,261 @@
 %09%09);%0A%09%7D%0A
+%09%0A%09@PostMapping(%22/manygreetings%22)%0A%09public Flux%3CString%3E getGreetings(%0A%09%09@RequestBody Mono%3CString%3E name%0A%09) %7B%0A%09%09return name%0A%09%09%09.flatMapMany(n -%3E Flux.generate(s -%3E s.next(n)))%0A%09%09%09.zipWith(Flux.range(1, 23))%0A%09%09%09.map(t -%3E %22Hello, %22 + t.getT1() + %22%5Cn%22);%0A%09%7D%0A
 %7D%0A

Add demo