This is not bread-utils, just the toaster
<repository>
<id>hotire</id>
<url>http://dl.bintray.com/hotire/utils</url>
</repository>
<dependency>
<groupId>com.github.hotire</groupId>
<artifactId>reactor-utils</artifactId>
<version>0.0.8.0</version>
</dependency>
commons-beanutils-based, springframework-core-convert-based
ServerRequest
-
queryParams
-
pathVariables
bind to instance of class type
Custom Convert
-
commons-beanutils
- LocalDateTime.class
- LocalDate.class
- Year.class
- Month.class
-
springframework-core-convert-based
- Long.class
- Boolean.class
public Mono<ServerResponse> handle(ServerRequest request) {
Data data = bind(request, Data.class)
....
}
: All values of ServerRequest(queryParams, pathVariables) into ValueObject
public Mono<ServerResponse> handle(ServerRequest request) {
return bindToMono(request, Data.class)
.filter(data -> {...})
.map(data -> {...})
.doOnError(error -> {...})
}
: All values of ServerRequest(queryParams, pathVariables) into Mono<ValueObject>
public Mono<ServerResponse> handle(ServerRequest request) {
final String userId = bindOne(request, String.class).orElse(DEFAULT);
....
....
}
: One value of ServerRequest(queryParam, pathVariable) into Optional<ValueObject>
public Mono<ServerResponse> handle(ServerRequest request) {
return bindOneToMono(request, String.class)
.map(userId -> userId.orElseThrow() -> {...})
.filter(userId -> {...})
.map(userId -> {...})
.doOnError(userId -> {...})
}
: One value of ServerRequest(queryParam, pathVariable) into Mono<Optional<ValueObject>>
MonoBackPressureSubscriber request to publisher and consume Mono then pull Mono from publisher
blog : https://blog.naver.com/gngh0101
reference : https://projectreactor.io/docs/core/release/reference/
Thread-local based MDC is difficult when you switch thread in Webflux.
If you want to maintain MDC, similarly the thread, MDC must also switch.
class Configuration {
static {
Schedulers.addExecutorServiceDecorator(MDCScheduledExecutorServiceDecorator.class.getName(),
(scheduler, scheduledExecutorService) -> new MDCScheduledExecutorServiceDecorator(scheduledExecutorService));
}
}
Provide decorator of HttpMessageReader / HttpMessageWriter.
Utf8HttpMessageWriterDecorator using HttpMessageWriter is also provided
public class Utf8HttpMessageWriterDecorator<T> extends HttpMessageWriterDecorator<T>{
//...
//...
}