b32f7969f224944e27e88808da274b951c48f37f
[demos/testing] / src / main / java / de / juplo / demo / RestController.java
1 package de.juplo.demo;
2
3
4 import org.springframework.http.MediaType;
5 import org.springframework.web.bind.annotation.GetMapping;
6 import org.springframework.web.bind.annotation.RequestParam;
7 import reactor.core.publisher.Mono;
8
9
10 /**
11  * Fetches and returns data from a remote-webserver.
12  * @author Kai Moritz
13  */
14 @org.springframework.web.bind.annotation.RestController
15 public class RestController
16 {
17   RemoteContentService service;
18
19
20   public RestController(RemoteContentService service)
21   {
22     this.service = service;
23   }
24
25
26   @GetMapping(path = "/", produces = MediaType.TEXT_PLAIN_VALUE)
27   public Mono<String> fetch(@RequestParam String path)
28   {
29     return service.getRemoteText(path);
30   }
31 }