Class HeaderMethodArgumentResolver
java.lang.Object
org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver
org.springframework.messaging.handler.annotation.support.HeaderMethodArgumentResolver
- All Implemented Interfaces:
HandlerMethodArgumentResolver
Resolver for
@Header arguments. Headers are resolved from
either the top-level header map or the nested
native header map.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.NamedValueInfo -
Constructor Summary
ConstructorsConstructorDescriptionHeaderMethodArgumentResolver(org.springframework.core.convert.ConversionService conversionService, org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateNamedValueInfo(org.springframework.core.MethodParameter parameter) Create theAbstractNamedValueMethodArgumentResolver.NamedValueInfoobject for the given method parameter.protected voidhandleMissingValue(String headerName, org.springframework.core.MethodParameter parameter, Message<?> message) Invoked when a value is required, butAbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.lang.String)returnednulland there is no default value.protected ObjectresolveArgumentInternal(org.springframework.core.MethodParameter parameter, Message<?> message, String name) Resolves the given parameter type and value name into an argument value.booleansupportsParameter(org.springframework.core.MethodParameter parameter) Whether the given method parameter is supported by this resolver.Methods inherited from class org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver
handleResolvedValue, resolveArgument
-
Constructor Details
-
HeaderMethodArgumentResolver
public HeaderMethodArgumentResolver(org.springframework.core.convert.ConversionService conversionService, @Nullable org.springframework.beans.factory.config.ConfigurableBeanFactory beanFactory)
-
-
Method Details
-
supportsParameter
public boolean supportsParameter(org.springframework.core.MethodParameter parameter) Description copied from interface:HandlerMethodArgumentResolverWhether the given method parameter is supported by this resolver.- Parameters:
parameter- the method parameter to check- Returns:
trueif this resolver supports the supplied parameter;falseotherwise
-
createNamedValueInfo
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(org.springframework.core.MethodParameter parameter) Description copied from class:AbstractNamedValueMethodArgumentResolverCreate theAbstractNamedValueMethodArgumentResolver.NamedValueInfoobject for the given method parameter. Implementations typically retrieve the method annotation by means ofMethodParameter.getParameterAnnotation(Class).- Specified by:
createNamedValueInfoin classAbstractNamedValueMethodArgumentResolver- Parameters:
parameter- the method parameter- Returns:
- the named value information
-
resolveArgumentInternal
@Nullable protected Object resolveArgumentInternal(org.springframework.core.MethodParameter parameter, Message<?> message, String name) throws Exception Description copied from class:AbstractNamedValueMethodArgumentResolverResolves the given parameter type and value name into an argument value.- Specified by:
resolveArgumentInternalin classAbstractNamedValueMethodArgumentResolver- Parameters:
parameter- the method parameter to resolve to an argument valuemessage- the current requestname- the name of the value being resolved- Returns:
- the resolved argument. May be
null - Throws:
Exception- in case of errors
-
handleMissingValue
protected void handleMissingValue(String headerName, org.springframework.core.MethodParameter parameter, Message<?> message) Description copied from class:AbstractNamedValueMethodArgumentResolverInvoked when a value is required, butAbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.lang.String)returnednulland there is no default value. Subclasses can throw an appropriate exception for this case.- Specified by:
handleMissingValuein classAbstractNamedValueMethodArgumentResolver- Parameters:
headerName- the name for the valueparameter- the target method parametermessage- the message being processed
-