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