Top Description Constructors Methods
org.springframework.web.servlet.mvc.method.annotation

public Class SessionAttributeMethodArgumentResolver

extends AbstractNamedValueMethodArgumentResolver
Class Inheritance
Imports
jakarta.servlet.ServletException, org.springframework.core.MethodParameter, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.bind.ServletRequestBindingException, org.springframework.web.bind.annotation.SessionAttribute, .ValueConstants, org.springframework.web.context.request.NativeWebRequest, .RequestAttributes, org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver

Resolves method arguments annotated with an @SessionAttribute.
Author
Rossen Stoyanchev
Since
4.3

Constructor Summary

AccessConstructor and Description
public

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 Object
resolveName(String
the name of the value being resolved
name
,
MethodParameter
the method parameter to resolve to an argument value (pre-nested in case of a java.util.Optional declaration)
parameter
,
NativeWebRequest
the current request
request
)

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

Resolve the given parameter type and value name into an argument value.

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:
handleMissingValuehandleMissingValueAfterConversionhandleResolvedValueresolveArgument

Constructor Detail

SessionAttributeMethodArgumentResolverback to summary
public SessionAttributeMethodArgumentResolver()

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 ServletException

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
resolveNameback to summary
protected Object resolveName(String name, MethodParameter parameter, NativeWebRequest request)

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

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

Resolve the given parameter type and value name into an argument value.

Parameters
name:String

the name of the value being resolved

parameter:MethodParameter

the method parameter to resolve to an argument value (pre-nested in case of a java.util.Optional declaration)

request:NativeWebRequest

the current request

Returns:Object

the resolved argument (may be null)

Annotations
@Override
@Nullable
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