In Spring WebFlux, a WebFilter is an interface used to intercept and process web requests and responses in a reactive manner. It provides a mechanism for implementing cross-cutting concerns, such as security, logging, or request/response manipulation, before the request reaches the target handler or after the handler has processed it.
- Interface Definition: The WebFilter interface defines a single method:
public interface WebFilter {
Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain);
}
- ServerWebExchange: Represents the HTTP request-response interaction, providing access to the ServerHttpRequest and ServerHttpResponse, along with other server-side properties.
- WebFilterChain: Allows the filter to delegate to the next filter in the chain or to the actual request handler.
'【 개발 이야기 】' 카테고리의 다른 글
MDCContext (2) | 2025.06.20 |
---|---|
람다를 사용한 Sl4j 보일러 플레이트 개선 (2) | 2025.06.20 |
[coroutine] runBlocking (0) | 2025.06.18 |
e.stackTrace와 e.stackTraceToString (1) | 2025.06.18 |
[kotlin] infix function (0) | 2025.06.17 |