public class HiddenHttpMethodFilter extends Object implements WebFilter
WebFilter that converts posted method parameters into HTTP methods,
retrievable via HttpRequest.getMethod(). Since browsers currently only
support GET and POST, a common technique is to use a normal POST with an additional
hidden form field (_method) to pass the "real" HTTP method along.
This filter reads that parameter and changes the HttpRequest.getMethod()
return value using ServerWebExchange.mutate().
The name of the request parameter defaults to _method, but can be
adapted via the methodParamName property.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_METHOD_PARAMETER_NAME
Default name of the form parameter with the HTTP method to use.
|
| Constructor and Description |
|---|
HiddenHttpMethodFilter() |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<Void> |
filter(ServerWebExchange exchange,
WebFilterChain chain)
Transform an HTTP POST into another method based on
methodParamName. |
void |
setMethodParamName(String methodParamName)
Set the name of the form parameter with the HTTP method to use.
|
public static final String DEFAULT_METHOD_PARAMETER_NAME
public void setMethodParamName(String methodParamName)
By default this is set to "_method".
public reactor.core.publisher.Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain)
methodParamName.