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
Modifier and Type | Class and Description |
---|---|
private static class |
HeaderMethodArgumentResolver.HeaderNamedValueInfo |
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. |
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getNativeHeaders(Message<?> message) |
private java.lang.Object |
getNativeHeaderValue(Message<?> message,
java.lang.String name) |
protected void |
handleMissingValue(java.lang.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 java.lang.Object |
resolveArgumentInternal(MethodParameter parameter,
Message<?> message,
java.lang.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.
|
handleResolvedValue, resolveArgument
private static final Log logger
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 java.lang.Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, java.lang.String name) throws java.lang.Exception
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
java.lang.Exception
- in case of errors@Nullable private java.lang.Object getNativeHeaderValue(Message<?> message, java.lang.String name)
@Nullable private java.util.Map<java.lang.String,java.util.List<java.lang.String>> getNativeHeaders(Message<?> message)
protected void handleMissingValue(java.lang.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