public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver
@Header
arguments. Headers are resolved from
either the top-level header map or the nested
native
header map.HeadersMethodArgumentResolver
,
NativeMessageHeaderAccessor
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
Constructor and Description |
---|
HeaderMethodArgumentResolver(ConversionService conversionService,
ConfigurableBeanFactory beanFactory) |
Modifier and Type | Method and Description |
---|---|
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo |
createNamedValueInfo(MethodParameter parameter)
Create the
AbstractNamedValueMethodArgumentResolver.NamedValueInfo object for the given method parameter. |
protected void |
handleMissingValue(String headerName,
MethodParameter parameter,
Message<?> message)
Invoked when a value is required, but
AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.lang.String)
returned null 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.
|
resolveArgumentValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolveArgument
public HeaderMethodArgumentResolver(ConversionService conversionService, @Nullable ConfigurableBeanFactory beanFactory)
public boolean supportsParameter(MethodParameter parameter)
HandlerMethodArgumentResolver
parameter
- the method parameter to checktrue
if this resolver supports the supplied parameter;
false
otherwiseprotected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)
AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.NamedValueInfo
object for the given method parameter.
Implementations typically retrieve the method annotation by means of
MethodParameter.getParameterAnnotation(Class)
.createNamedValueInfo
in class AbstractNamedValueMethodArgumentResolver
parameter
- the method parameter@Nullable protected Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, String name)
AbstractNamedValueMethodArgumentResolver
resolveArgumentInternal
in class AbstractNamedValueMethodArgumentResolver
parameter
- the method parameter to resolve to an argument valuemessage
- the current requestname
- the name of the value being resolvednull
protected void handleMissingValue(String headerName, MethodParameter parameter, Message<?> message)
AbstractNamedValueMethodArgumentResolver
AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal(org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>, java.lang.String)
returned null
and there is no default value. Sub-classes can
throw an appropriate exception for this case.handleMissingValue
in class AbstractNamedValueMethodArgumentResolver
headerName
- the name for the valueparameter
- the target method parametermessage
- the message being processed