Files
spring-boot-rest/spring-5-reactive-client/src/main/java/com/baeldung/reactive/controller/UploadController.java
Trixi Turny f3469367ed BAEL-5054 throw ServiceException when not OK
BAEL-5054 fix test name and tidy indent

BAEL-5054 remove unnecessary changes

BAEL-5054 restore main class name

BAEL-5054 rename test to end with UnitTest
2021-08-30 16:34:43 +01:00

31 lines
967 B
Java

package com.baeldung.reactive.controller;
import com.baeldung.reactive.service.ReactiveUploadService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import reactor.core.publisher.Mono;
@RestController
public class UploadController {
final ReactiveUploadService uploadService;
public UploadController(ReactiveUploadService uploadService) {
this.uploadService = uploadService;
}
@PostMapping(path = "/upload")
@ResponseBody
public Mono<HttpStatus> uploadPdf(@RequestParam("file") final MultipartFile multipartFile) {
return uploadService.uploadPdf(multipartFile.getResource());
}
@PostMapping(path = "/upload/multipart")
@ResponseBody
public Mono<HttpStatus> uploadMultipart(@RequestParam("file") final MultipartFile multipartFile) {
return uploadService.uploadMultipart(multipartFile);
}
}