Class HeaderMethodArgumentResolver
java.lang.Object
org.springframework.messaging.handler.annotation.reactive.AbstractNamedValueMethodArgumentResolver
org.springframework.messaging.handler.annotation.reactive.HeaderMethodArgumentResolver
- All Implemented Interfaces:
HandlerMethodArgumentResolver
,SyncHandlerMethodArgumentResolver
Resolver for
@Header
arguments. Headers are resolved from
either the top-level header map or the nested
native
header map.- Since:
- 5.2
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.messaging.handler.annotation.reactive.AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
-
Constructor Summary
ConstructorDescriptionHeaderMethodArgumentResolver
(ConversionService conversionService, ConfigurableBeanFactory beanFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateNamedValueInfo
(MethodParameter parameter) Create theAbstractNamedValueMethodArgumentResolver.NamedValueInfo
object for the given method parameter.protected void
handleMissingValue
(String headerName, MethodParameter parameter, Message<?> message) Invoked when a value is required, butAbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.lang.String)
returnednull
and there is no default value.protected Object
resolveArgumentInternal
(MethodParameter parameter, Message<?> message, String name) Resolves the given parameter type and value name into an argument value.boolean
supportsParameter
(MethodParameter parameter) Whether the given method parameter is supported by this resolver.Methods inherited from class org.springframework.messaging.handler.annotation.reactive.AbstractNamedValueMethodArgumentResolver
resolveArgumentValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.messaging.handler.invocation.reactive.SyncHandlerMethodArgumentResolver
resolveArgument
-
Constructor Details
-
HeaderMethodArgumentResolver
public HeaderMethodArgumentResolver(ConversionService conversionService, @Nullable ConfigurableBeanFactory beanFactory)
-
-
Method Details
-
supportsParameter
Description copied from interface:HandlerMethodArgumentResolver
Whether the given method parameter is supported by this resolver.- Parameters:
parameter
- the method parameter to check- Returns:
true
if this resolver supports the supplied parameter;false
otherwise
-
createNamedValueInfo
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter) Description copied from class:AbstractNamedValueMethodArgumentResolver
Create theAbstractNamedValueMethodArgumentResolver.NamedValueInfo
object for the given method parameter. Implementations typically retrieve the method annotation by means ofMethodParameter.getParameterAnnotation(Class)
.- Specified by:
createNamedValueInfo
in classAbstractNamedValueMethodArgumentResolver
- Parameters:
parameter
- the method parameter- Returns:
- the named value information
-
resolveArgumentInternal
@Nullable protected Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, String name) Description copied from class:AbstractNamedValueMethodArgumentResolver
Resolves the given parameter type and value name into an argument value.- Specified by:
resolveArgumentInternal
in 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
-
handleMissingValue
Description copied from class:AbstractNamedValueMethodArgumentResolver
Invoked when a value is required, butAbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.lang.String)
returnednull
and there is no default value. Sub-classes can throw an appropriate exception for this case.- Specified by:
handleMissingValue
in classAbstractNamedValueMethodArgumentResolver
- Parameters:
headerName
- the name for the valueparameter
- the target method parametermessage
- the message being processed
-