Top Description Inners Constructors Methods
org.springframework.web.method.annotation

public abstract Class AbstractCookieValueMethodArgumentResolver

extends AbstractNamedValueMethodArgumentResolver
Class Inheritance
Imports
org.springframework.beans.factory.config.ConfigurableBeanFactory, org.springframework.core.MethodParameter, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.bind.MissingRequestCookieException, .ServletRequestBindingException, .WebDataBinder, org.springframework.web.bind.annotation.CookieValue, org.springframework.web.context.request.NativeWebRequest

A base abstract class to resolve method arguments annotated with @CookieValue. Subclasses extract the cookie value from the request.

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.

A WebDataBinder may be invoked to apply type conversion to the resolved cookie value.

Authors
Arjen Poutsma, Rossen Stoyanchev
Since
3.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public
AbstractCookieValueMethodArgumentResolver(ConfigurableBeanFactory
a bean factory to use for resolving ${...} placeholder and #{...} SpEL expressions in default values; or null if default values are not expected to contain expressions
beanFactory
)

Crate a new AbstractCookieValueMethodArgumentResolver instance.

Method Summary

Modifier and TypeMethod and Description
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo
createNamedValueInfo(MethodParameter
the method parameter
parameter
)

Implements abstract org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Create the NamedValueInfo object for the given method parameter.
protected void
handleMissingValue(String
the name for the value
name
,
MethodParameter
the method parameter
parameter
)

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Invoked when a named value is required, but resolveName(String, MethodParameter, NativeWebRequest) returned null and there is no default value.
protected void
handleMissingValueAfterConversion(String
the name for the value
name
,
MethodParameter
the method parameter
parameter
,
NativeWebRequest
the current request
request
)

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValueAfterConversion.

Invoked when a named value is present but becomes null after conversion.
public boolean
supportsParameter(MethodParameter
the method parameter to check
parameter
)

Implements org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter.

Whether the given method parameter is supported by this resolver.
Inherited from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:
handleMissingValuehandleResolvedValueresolveArgumentresolveName

Constructor Detail

AbstractCookieValueMethodArgumentResolverback to summary
public AbstractCookieValueMethodArgumentResolver(ConfigurableBeanFactory beanFactory)

Crate a new AbstractCookieValueMethodArgumentResolver instance.

Parameters
beanFactory:ConfigurableBeanFactory

a bean factory to use for resolving ${...} placeholder and #{...} SpEL expressions in default values; or null if default values are not expected to contain expressions

Method Detail

createNamedValueInfoback to summary
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)

Implements abstract org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Create the NamedValueInfo object for the given method parameter. Implementations typically retrieve the method annotation by means of MethodParameter#getParameterAnnotation(Class).

Parameters
parameter:MethodParameter

the method parameter

Returns:AbstractNamedValueMethodArgumentResolver.NamedValueInfo

the named value information

Annotations
@Override
handleMissingValueback to summary
protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Invoked when a named value is required, but resolveName(String, MethodParameter, NativeWebRequest) returned null and there is no default value. Subclasses typically throw an exception in this case.

Parameters
name:String

the name for the value

parameter:MethodParameter

the method parameter

Annotations
@Override
handleMissingValueAfterConversionback to summary
protected void handleMissingValueAfterConversion(String name, MethodParameter parameter, NativeWebRequest request) throws Exception

Overrides org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValueAfterConversion.

Doc from org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.handleMissingValueAfterConversion.

Invoked when a named value is present but becomes null after conversion.

Parameters
name:String

the name for the value

parameter:MethodParameter

the method parameter

request:NativeWebRequest

the current request

Annotations
@Override
supportsParameterback to summary
public boolean supportsParameter(MethodParameter parameter)

Implements org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter.

Doc from org.springframework.web.method.support.HandlerMethodArgumentResolver.supportsParameter.

Whether the given method parameter is supported by this resolver.

Parameters
parameter:MethodParameter

the method parameter to check

Returns:boolean

true if this resolver supports the supplied parameter; false otherwise

Annotations
@Override
org.springframework.web.method.annotation back to summary

private final Class AbstractCookieValueMethodArgumentResolver.CookieValueNamedValueInfo

extends NamedValueInfo
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Constructor Detail

CookieValueNamedValueInfoback to summary
private CookieValueNamedValueInfo(CookieValue annotation)