With our reactive image service in place, we can start to work on the reactive file controller.
For starters, let's create a HomeController as shown here:
@Controller public class HomeController { private static final String BASE_PATH = "/images"; private static final String FILENAME = "{filename:.+}"; private final ImageService imageService; public HomeController(ImageService imageService) { this.imageService = imageService; }
The preceding code can be described as follows:
- @Controller: This indicates that it is a web controller, and will be registered by Spring Boot to handle web requests.
- BASE_PATH: This is a static string used to define the base of many routes.
- FILENAME: This is a pattern for filenames where the "." is included. Otherwise, Spring...