public class CookieValueMethodArgumentResolver extends AbstractNamedValueSyncArgumentResolver
@CookieValue
.
An @CookieValue
is a named value that is resolved from a cookie.
It has a required flag and a default value to fall back on when the cookie
does not exist.
Modifier and Type | Class and Description |
---|---|
private static class |
CookieValueMethodArgumentResolver.CookieValueNamedValueInfo |
AbstractNamedValueArgumentResolver.NamedValueInfo
logger
Constructor and Description |
---|
CookieValueMethodArgumentResolver(ConfigurableBeanFactory factory,
ReactiveAdapterRegistry registry)
Create a new
CookieValueMethodArgumentResolver instance. |
Modifier and Type | Method and Description |
---|---|
protected AbstractNamedValueArgumentResolver.NamedValueInfo |
createNamedValueInfo(MethodParameter parameter)
Create the
AbstractNamedValueArgumentResolver.NamedValueInfo object for the given method parameter. |
protected void |
handleMissingValue(java.lang.String name,
MethodParameter parameter)
Invoked when a named value is required, but
AbstractNamedValueArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange) returned
null and there is no default value. |
protected java.lang.Object |
resolveNamedValue(java.lang.String name,
MethodParameter parameter,
ServerWebExchange exchange)
Actually resolve the value synchronously.
|
boolean |
supportsParameter(MethodParameter param)
Whether this resolver supports the given method parameter.
|
resolveArgument, resolveArgumentValue, resolveName
handleMissingValue, handleResolvedValue
checkAnnotatedParamNoReactiveWrapper, checkParameterType, checkParameterTypeNoReactiveWrapper, getAdapterRegistry
public CookieValueMethodArgumentResolver(@Nullable ConfigurableBeanFactory factory, ReactiveAdapterRegistry registry)
CookieValueMethodArgumentResolver
instance.factory
- a bean factory to use for resolving ${...}
placeholder and #{...}
SpEL expressions in default values;
or null
if default values are not expected to contain expressionsregistry
- for checking reactive type wrapperspublic boolean supportsParameter(MethodParameter param)
HandlerMethodArgumentResolver
param
- the method parameterprotected AbstractNamedValueArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
AbstractNamedValueArgumentResolver
AbstractNamedValueArgumentResolver.NamedValueInfo
object for the given method parameter.
Implementations typically retrieve the method annotation by means of
MethodParameter.getParameterAnnotation(Class)
.createNamedValueInfo
in class AbstractNamedValueArgumentResolver
parameter
- the method parameterprotected java.lang.Object resolveNamedValue(java.lang.String name, MethodParameter parameter, ServerWebExchange exchange)
AbstractNamedValueSyncArgumentResolver
resolveNamedValue
in class AbstractNamedValueSyncArgumentResolver
protected void handleMissingValue(java.lang.String name, MethodParameter parameter)
AbstractNamedValueArgumentResolver
AbstractNamedValueArgumentResolver.resolveName(String, MethodParameter, ServerWebExchange)
returned
null
and there is no default value. Subclasses typically throw an
exception in this case.handleMissingValue
in class AbstractNamedValueArgumentResolver
name
- the name for the valueparameter
- the method parameter